[cfe-commits] [PATCH] Crash when constant folding switch statements (Bug 11656)

Aaron Ballman aaron at aaronballman.com
Mon Jan 16 09:12:36 PST 2012


On Mon, Jan 16, 2012 at 11:01 AM, jahanian <fjahanian at apple.com> wrote:
> You are emitting body of the case statement when no enclosing switch is found. Is this intended behavior (gcc compatible behavior)?
> If so, patch LGTM.

It is intended behavior, but whether my intentions are correct or not
is up for debate.  ;-)  I am emitting the case body code because it
strikes me as being akin to a "fall-through" case.  I looked to see
what MSVC does with the code, and it too emits the case body (but did
not test gcc as I didn't have it handy).  Also, Duff's Device came to
mind as another example.

However, I'm still a Junior Language Lawyer and couldn't see anything
explicit in the language specification to verify the behavior.

~Aaron



More information about the cfe-commits mailing list