2021-02-27 04:34 CET

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0000522Frama-CKernelpublic2011-10-10 14:14
ReporterJochen 
Assigned Tovirgile 
PrioritynormalSeveritycrashReproducibilityalways
StatusclosedResolutionfixed 
Product VersionFrama-C Boron-20100401 
Target VersionFixed in VersionFrama-C Nitrogen-20111001 
Summary0000522: size of long array can't be represented with OCaml int
DescriptionWhen running the attached program, Jessie asked me to report a 'crash':

liveness_test.c:57:[jessie] failure: Unexpected exception.
                  Please submit bug report (Ref. "Cil.SizeOfError("Array is so long that its size can't be represented with an OCaml int.", _)").
[kernel] The full backtrace is:
         Raised at file "src/kernel/log.ml", line 506, characters 30-31
         Called from file "src/kernel/log.ml", line 500, characters 2-9
         Re-raised at file "src/kernel/log.ml", line 503, characters 8-9
         Called from file "src/lib/type.ml", line 746, characters 40-45
         Called from file "queue.ml", line 134, characters 6-20
         Called from file "src/kernel/boot.ml", line 50, characters 4-20
         Called from file "src/kernel/cmdline.ml", line 170, characters 4-8
         
         Plug-in jessie aborted because of an internal error.
         Please report as 'crash' at http://bts.frama-c.com

In fact, the array "hist" in line 52 has a size of (4+4+4)*16777215=201326580, which is beyond the max value of a signed int. I'll just decrease the upper bound of that array as a workaround. (By the way: gcc has similar problems with large arrays.)
TagsNo tags attached.
Attached Files
  • c file icon liveness_test.c (1,288 bytes) 2010-06-28 18:45 -
    typedef int timeT;
    typedef int speedT;
    typedef int bool;
    
    #define true		((bool)1)
    #define false		((bool)0)
    
    #define endOfTime	0x00ffffff
    
    
    
    /*@ ensures *sp < \old(*sp);
        assigns \nothing;
        //assigns *sp;
    */
    extern void doBrake(speedT *sp);
    
    
    
    /*@ ensures \result == true || \result == false; */
    extern bool boolSensorValue(void);
    
    
    
    /*@ requires \valid(emState);
        requires \valid(sp);
        ensures emButton ==> *emState;
        ensures !emButton && *sp == 0 ==> !*emState;
    */
    void handleEmergency(
        bool emButton,
        bool *emState,
        speedT *sp)
    {
        if (emButton) {
    	*emState = true;
        } else if (*sp == 0) {
    	*emState = false;
        }
        if (*emState)
    	doBrake(sp);
    }
    
    
    struct _state {
        speedT speed;
        bool emState;
        bool emButton;
    };
    
    struct _state hist[endOfTime];
    
    /*@ ensures \forall timeT t1; hist[t1].emButton
    	==> \exists timeT t2; t2 >= t1 && hist[t2].speed == 0;
    */
    void main(void)
    {
        timeT t;
        speedT speed;
        bool emState;
        bool emButton;
    
        emState = false;
        /*@ loop variant endOfTime - t;
    	loop invariant 0 <= t <= endOfTime;
        */
        for (t=0; t<endOfTime; ++t) {
    	emButton = boolSensorValue();
    	handleEmergency(emButton,&emState,&speed);
    	hist[t].speed = speed;
    	hist[t].emState = emState;
    	hist[t].emButton = emButton;
        }
    }
    
    
    c file icon liveness_test.c (1,288 bytes) 2010-06-28 18:45 +

-Relationships
+Relationships

-Notes

~0000961

virgile (developer)

This is part of a more general integer representation issue: all integer constants should be moved to Big_ints.

~0001977

monate (reporter)

Fixed since rev 13959. Will be available in Nitrogen.
Thanks for the bug report.
+Notes

-Issue History
Date Modified Username Field Change
2010-06-28 18:45 Jochen New Issue
2010-06-28 18:45 Jochen Status new => assigned
2010-06-28 18:45 Jochen Assigned To => cmarche
2010-06-28 18:45 Jochen File Added: liveness_test.c
2010-07-01 09:30 virgile Note Added: 0000961
2010-07-01 09:30 virgile Assigned To cmarche => virgile
2010-07-01 09:30 virgile Status assigned => acknowledged
2010-07-01 09:30 virgile Category Plug-in > jessie => Kernel
2011-06-15 19:28 monate Note Added: 0001977
2011-06-15 19:28 monate Status acknowledged => resolved
2011-06-15 19:28 monate Resolution open => fixed
2011-10-10 14:13 signoles Fixed in Version => Frama-C Nitrogen-20111001
2011-10-10 14:14 signoles Status resolved => closed
+Issue History