The deficiency described in #1159 item 3 also applies to the C99 parser: Import of switch instructions may cause wrong structure if branches are conditionally terminated, as e.g. in the following example (case 0 and case 2):
#include <stdio.h>
#include <stdbool.h>
int test1163(int number, bool left) {
switch (number) {
case 0:
if (left) {
return 5;
}
else {
number = 2;
break;
}
case 1:
printf("This should not be appended to case 0!");
break;
case 2:
if (!left) {
break;
}
number = -4;
case 3:
while (true) {
if (--number == 0) break;
}
default:
return number;
}
return -1;
}
Clearly, case 1 schould not be appended to case 0 because case 0 terminates in all cases, but break and return instructions are "hidden" within an alternative. C99 import is still too inchoate to find that out, instead an inapproprate "leave" element remains:
The deficiency described in #1159 item 3 also applies to the C99 parser: Import of switch instructions may cause wrong structure if branches are conditionally terminated, as e.g. in the following example (case 0 and case 2):
Clearly, case 1 schould not be appended to case 0 because case 0 terminates in all cases, but
break
andreturn
instructions are "hidden" within an alternative. C99 import is still too inchoate to find that out, instead an inapproprate "leave" element remains: