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

jahanian fjahanian at apple.com
Mon Jan 16 09:23:17 PST 2012


On Jan 16, 2012, at 9:12 AM, Aaron Ballman wrote:

> 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.
> 

I tried gcc and it behaves the same as your patch.

- Fariborz

> ~Aaron




More information about the cfe-commits mailing list