Skip to content

Initializer of static variable refers to size of type of local variable

ID0001645: This issue was created automatically from Mantis Issue 1645. Further discussion may take place here.


Id Project Category View Due Date Updated
ID0001645 Frama-C Kernel public 2014-02-13 2014-03-24
Reporter pascal Assigned To virgile Resolution open
Priority low Severity minor Reproducibility always
Platform - OS - OS Version -
Product Version Frama-C Fluorine-20130601 Target Version - Fixed in Version -

Description :

CONTEXT: This issue does not originate from an industrial application. It is reported for the lulz.

DESCRIPTION: The program below is accepted by gcc and clang, and rejected by Frama-C. It seems that the compilers are right to accept it.

~ $ cat t.c

unsigned f(void) { int a; static unsigned s = sizeof(a); return s; }

~ $ clang -std=c99 -pedantic -Wall -c t.c ~ $ frama-c t.c [kernel] preprocessing with "gcc -C -E -I. t.c" t.c:4:[kernel] user error: Forbidden access to local variable a in static initializer [kernel] user error: skipping file "t.c" that has errors. [kernel] Frama-C aborted: invalid user input. ~ $

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information