Frama-C Bug Tracking System - Frama-C
View Issue Details
0001572Frama-CKernelpublic2013-11-27 10:052014-03-13 15:57
Reporterdmentre 
Assigned Toyakobowski 
PrioritynormalSeveritycrashReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product VersionFrama-C Fluorine-20130601 
Target VersionFixed in VersionFrama-C Neon-20140301 
Summary0001572: Multiple contracts merge twice resutling in Kernel error
DescriptionWith the attached files, when I call the following command I get a backtrace:
  frama-c questions/q18_a.c questions/q18_b.c
"""
[kernel] preprocessing with "gcc -C -E -I. questions/q18_a.c"
questions/q18_a.h:6:[kernel] warning: found two contracts. Merging them
[kernel] preprocessing with "gcc -C -E -I. questions/q18_b.c"
questions/q18_a.c:18:[kernel] warning: found two contracts. Merging them
questions/q18_a.c:18:[kernel] warning: found two contracts. Merging them
[kernel] failure: trying to register twice property `requires
                  p ? 10'.
                  That is forbidden (kernel invariant broken).
[kernel] Current source was: questions/q18_b.c:8
         The full backtrace is:
         Raised at file "src/kernel/log.ml", line 523, characters 30-31
         Called from file "src/kernel/log.ml", line 517, characters 9-16
         Re-raised at file "src/kernel/log.ml", line 520, characters 15-16
         Called from file "src/logic/property_status.ml", line 292, characters 4-132
         Called from file "list.ml", line 75, characters 12-15
         Called from file "set.ml", line 305, characters 38-41
         Called from file "src/kernel/file.ml", line 1487, characters 2-53
         Called from file "src/kernel/file.ml", line 2020, characters 4-27
         Called from file "src/kernel/ast.ml", line 103, characters 2-28
         Called from file "src/kernel/ast.ml", line 114, characters 53-71
         Called from file "src/kernel/boot.ml", line 29, characters 6-20
         Called from file "src/kernel/cmdline.ml", line 732, characters 2-9
         Called from file "src/kernel/cmdline.ml", line 212, characters 4-8
"""

Strangely enough, I call frama-c on the files in the reverse order, everything goes well:
  frama-c questions/q18_b.c questions/q18_a.c
"""
[kernel] preprocessing with "gcc -C -E -I. questions/q18_b.c"
[kernel] preprocessing with "gcc -C -E -I. questions/q18_a.c"
questions/q18_a.h:6:[kernel] warning: found two contracts. Merging them
questions/q18_a.c:18:[kernel] warning: found two contracts. Merging them
"""
TagsNo tags attached.
Attached Filesc q18_a.c (245) 2013-11-27 10:05
https://bts.frama-c.com/file_download.php?file_id=607&type=bug
? q18_a.h (86) 2013-11-27 10:07
https://bts.frama-c.com/file_download.php?file_id=608&type=bug
c q18_b.c (179) 2013-11-27 10:07
https://bts.frama-c.com/file_download.php?file_id=609&type=bug

Notes
(0004345)
yakobowski   
2013-11-27 15:22   
This bug has already been fixed in the development version. With both orderings, you obtain the desired AST (in which all the specifications for f have been merged). The reason you obtain one crash in one case but not the other is the fact that there 3 specifications for f: one in the .h that Frama-C sees twice (one time for each .c), and one in q18_b.c. Depending on the way you sort your files, those three specifications get merged differently.

Issue History
2013-11-27 10:05dmentreNew Issue
2013-11-27 10:05dmentreFile Added: q18_a.c
2013-11-27 10:07dmentreFile Added: q18_a.h
2013-11-27 10:07dmentreFile Added: q18_b.c
2013-11-27 15:22yakobowskiNote Added: 0004345
2013-11-27 15:22yakobowskiStatusnew => resolved
2013-11-27 15:22yakobowskiResolutionopen => fixed
2013-11-27 20:52yakobowskiStatusresolved => assigned
2013-11-27 20:52yakobowskiAssigned To => yakobowski
2013-11-27 20:55yakobowskiStatusassigned => resolved
2014-03-13 15:56signolesFixed in Version => Frama-C Neon-20140301
2014-03-13 15:57signolesStatusresolved => closed