#76 Switches broken with block attributes

Bug
closed-works-for-me
nobody
5
2009-04-17
2007-10-12
No

I think the problem is that in doBody in cabs2cil.ml cases are being thrown away when handling a block.

This program demonstrates the problem. (Comment out the blockattribute before giving the code to GCC.)

#include <stdio.h>

int f(int x)
{
switch (x) { __blockattribute__(x)
case 1:
return 2;
}
return 0;
}

int main()
{
printf(f(1) == 2 ? "PASS\n" : "FAIL\n");
return 0;
}

I'm attaching a patch that seems to help.

Discussion

  • David Gay
    David Gay
    2009-04-17

    • status: open --> closed-works-for-me
     
  • David Gay
    David Gay
    2009-04-17

    I can't reproduce this with the latest SVN