Skip to content

switch and case expressions must be integer

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


Id Project Category View Due Date Updated
ID0000311 Frama-C Kernel public 2009-11-02 2010-04-13
Reporter virgile Assigned To virgile Resolution fixed
Priority normal Severity minor Reproducibility always
Platform - OS - OS Version -
Product Version Frama-C GIT, precise the release id Target Version - Fixed in Version Frama-C Boron-20100401

Description :

following code is happily parsed by frama-c (who at least casts the "a" in the switch to int). It should fails with a type error

  • on the switch
  • on the case (parameter must be an integer constant according to norm)

float v;

static void fun(void) { switch ("a") { case "a": if (v > fabs(1)) { } break; } }

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