Frama-C Bug Tracking System

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0002235Frama-CKernelpublic2016-06-21 22:352017-05-31 19:05
Assigned Tovirgile 
PlatformOSOS Version
Product VersionFrama-C Aluminium 
Target VersionFixed in VersionFrama-C 15-Phosphorus 
Summary0002235: Functions that claim to return a struct but don't cause a crash
DescriptionIf a function returns a struct in its declaration, but it's method body does not return anything, Frama-C will warn about not finding a return value, and then crash.

While the kernel does warn you this is an issue, no invalid operation on the user's part should cause a crash. Instead, it should cause a user error.
Steps To Reproduce== File bug.c:

struct s {
    int i;

struct s foo() {}

== Run command:

frama-c bug.c

== Output:

[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing)
[kernel] Parsing bug.c (with preprocessing)
bug2.c:5:[kernel] warning: Body of function foo falls-through and cannot find an appropriate return value
bug2.c:5:[kernel] failure: Found return without value in function foo
[kernel] Current source was: bug.c:5
         The full backtrace is:
         Raised at file "src/kernel_services/plugin_entry_points/", line 583, characters 30-31
         Called from file "src/kernel_services/plugin_entry_points/", line 577, characters 9-16
         Re-raised at file "src/kernel_services/plugin_entry_points/", line 580, characters 15-16
         Called from file "src/kernel_internals/typing/", line 246, characters 8-87
         Called from file "src/kernel_internals/typing/", line 354, characters 22-54
         Called from file "src/kernel_internals/typing/", line 361, characters 13-35
         Called from file "src/kernel_services/ast_queries/", line 891, characters 6-26
         Called from file "", line 73, characters 12-15
         Called from file "src/kernel_services/ast_queries/", line 1143, characters 5-43
         Called from file "src/kernel_services/ast_queries/", line 1579, characters 2-22
         Called from file "src/kernel_services/ast_queries/", line 1666, characters 4-27
         Called from file "src/kernel_services/ast_data/", line 111, characters 2-28
         Called from file "src/kernel_services/ast_data/", line 123, characters 53-71
         Called from file "src/kernel_internals/runtime/", line 29, characters 6-20
         Called from file "src/kernel_services/cmdline_parameters/", line 787, characters 2-9
         Called from file "src/kernel_services/cmdline_parameters/", line 817, characters 18-64
         Called from file "src/kernel_services/cmdline_parameters/", line 228, characters 4-8
         Frama-C aborted: internal error.
         Please report as 'crash' at [^]
         Your Frama-C version is Aluminium-20160501.
         Note that a version and a backtrace alone often do not contain enough
         information to understand the bug. Guidelines for reporting bugs are at: [^]
Additional InformationTested with Aluminum on Linux 64-bit.
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
yakobowski (manager)
2016-12-08 10:23

Indeed. This is a limitation of Frama-C, that does not allow a function declared as non-void to *not* return something. We will turn the crash into a hard error.
virgile (developer)
2016-12-12 10:02

Fixed by commit b6ab86c71f70542a73b705bb5d60f2492e87663e

- Issue History
Date Modified Username Field Change
2016-06-21 22:35 jrobbins New Issue
2016-08-12 09:54 signoles Assigned To => virgile
2016-08-12 09:54 signoles Status new => assigned
2016-12-08 10:23 yakobowski Note Added: 0006310
2016-12-12 10:02 virgile Note Added: 0006312
2016-12-12 10:02 virgile Status assigned => resolved
2016-12-12 10:02 virgile Fixed in Version => Frama-C GIT, precise the release id
2016-12-12 10:02 virgile Resolution open => fixed
2017-05-31 19:04 signoles Fixed in Version Frama-C GIT, precise the release id =>
2017-05-31 19:04 signoles Fixed in Version => Frama-C 15-Phosphorus
2017-05-31 19:05 signoles Status resolved => closed

Copyright © 2000 - 2018 MantisBT Team
Powered by Mantis Bugtracker