2021-01-22 19:16 CET

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0001572Frama-CKernelpublic2014-03-13 15:57
Reporterdmentre 
Assigned Toyakobowski 
PrioritynormalSeveritycrashReproducibilityalways
StatusclosedResolutionfixed 
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 Files
  • c file icon q18_a.c (245 bytes) 2013-11-27 10:05 -
    /* q18_a.c */
    
    #include "q18_a.h"
    
    static int a = 0;
    
    /*@ requires a <= 10;
        ensures a == \old(a) + 1;
        assigns a;
    */
    void incr_a(void)
    {
      a += 1;
    }
    
    /*@ assigns a;
     */
    int f(int p)
    {
      if (a <= 10) {
        incr_a();
      }
    
      return p + 1;
    }
    
    c file icon q18_a.c (245 bytes) 2013-11-27 10:05 +
  • ? file icon q18_a.h (86 bytes) 2013-11-27 10:07 -
    /* q18_a.h */
    
    /*@ requires p <= 10;
        ensures \result == p + 1;
     */
    int f(int p);
    
    
    ? file icon q18_a.h (86 bytes) 2013-11-27 10:07 +
  • c file icon q18_b.c (179 bytes) 2013-11-27 10:07 -
    #include "q18_a.h"
    
    /*@ requires p <= 10;
        ensures \result == p + 1;
        assigns \nothing; // unprovable, cannot put "a" neither
     */
    int g(int p)
    {
      int r;
    
      return f(p);
    }
    
    c file icon q18_b.c (179 bytes) 2013-11-27 10:07 +

-Relationships
+Relationships

-Notes

~0004345

yakobowski (manager)

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.
+Notes

-Issue History
Date Modified Username Field Change
2013-11-27 10:05 dmentre New Issue
2013-11-27 10:05 dmentre File Added: q18_a.c
2013-11-27 10:07 dmentre File Added: q18_a.h
2013-11-27 10:07 dmentre File Added: q18_b.c
2013-11-27 15:22 yakobowski Note Added: 0004345
2013-11-27 15:22 yakobowski Status new => resolved
2013-11-27 15:22 yakobowski Resolution open => fixed
2013-11-27 20:52 yakobowski Status resolved => assigned
2013-11-27 20:52 yakobowski Assigned To => yakobowski
2013-11-27 20:55 yakobowski Status assigned => resolved
2014-03-13 15:56 signoles Fixed in Version => Frama-C Neon-20140301
2014-03-13 15:57 signoles Status resolved => closed
+Issue History