Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • F frama-c
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 168
    • Issues 168
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • Deployments
    • Deployments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
    • Model experiments
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • Repository
  • Wiki
    • Wiki
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • pub
  • frama-c
  • Issues
  • #566

frama-c gets confused by comma operator inside ternary operator: cannot cast from void to char

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


Id Project Category View Due Date Updated
ID0002117 Frama-C Kernel public 2015-05-09 2016-01-26
Reporter edwin Assigned To yakobowski Resolution fixed
Priority normal Severity minor Reproducibility always
Platform Linux debian 3.16.0-4-amd64 #1 S OS Debian GNU/Linux OS Version Jessie
Product Version Frama-C Sodium Target Version - Fixed in Version Frama-C Magnesium

Description :

GCC and Clang correctly parse and compile the testcase below, however frama-c considers it invalid (cannot cast from void to char).

In (char)(1?(((x)=6),1):0) AFAICT the type of (((x)=6),1) is integer, the void on the lhs of the comma operator should be ignored.

Additional Information :

$ frama-c --version Version: Sodium-20150201 Compilation date: Thu May 7 22:46:49 EEST 2015 Share path: /home/edwin/.opam/system/share/frama-c (may be overridden with FRAMAC_SHARE variable) Library path: /home/edwin/.opam/system/lib/frama-c (may be overridden with FRAMAC_LIB variable) Plug-in paths: /home/edwin/.opam/system/lib/frama-c/plugins (may be overridden with FRAMAC_PLUGIN variable)

$ ocaml -vnum 4.01.0

I originally encountered this problem when trying to parse sqlite3 with frama-c, see the getVarint32 macro. http://www.sqlite.org/cgi/src/artifact/20d9c59fd8277450

Steps To Reproduce :

$ cat >x.c <<EOF void foo(void) { char x; (char)(1?(((x)=6),1):0); (void)((char)(1?(((x)=6),1):0)); } EOF

$ frama-c x.c [kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing x.c (with preprocessing) x.c:3:[kernel] user error: cannot cast from void to char [kernel] user error: stopping on file "x.c" that has errors. Add '-kernel-msg-key pp' for preprocessing command. [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
Assignee
Assign to
Time tracking