Bug 11656 demonstrates a crash in the code generator on the following
(reduced) code:

int main(void){
        int x = 0;
        int i = 0;
        switch (4) {
                case 4: do {i++; x++; int x = 5; case 5: x++;} while (i < 3);
        }
        return x;
}

The crash happens because we omit the switch and case constructs
during constant folding, and simply perform the do loop.  However, the
do loop still has a case statement in it, but no enclosing switch
(that the CG recognizes).

I've attached a patch that should address this issue -- if there's no
enclosing switch instance available for a case statement, we generate
the sub statement without the accompanying case.

HTH!

~Aaron

Attachment: switch_folding.patch
Description: Binary data

_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to