Test case would be nice - and, naively: is there any reason this wouldn't be fixed up by the constant-folding code? (perhaps it's better the way you've fixed it, but I am curious - leaving cases without switches around when constant folding seems a bit suspect/odd)
On Sun, Jan 15, 2012 at 3:36 PM, Aaron Ballman <[email protected]> wrote: > 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 > > _______________________________________________ > cfe-commits mailing list > [email protected] > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits > _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
