Message ID | 20140328143805.GA4275@redhat.com |
---|---|
State | New |
Headers | show |
On Fri, 28 Mar 2014, Marek Polacek wrote: > PR51088 contains some Really Bizzare code. We should tell users > not to do any shenanigans like that. > > Ok for trunk? I don't think a doc patch resolves this bug. The compiler should never generate code with an undefined reference to a local label like that; either the code should get a compile-time error (that's what I suggest), or it should generate output that links but has undefined behavior at runtime.
diff --git gcc/doc/extend.texi gcc/doc/extend.texi index f9114ab..215d0a2 100644 --- gcc/doc/extend.texi +++ gcc/doc/extend.texi @@ -206,6 +206,9 @@ Jumping into a statement expression with @code{goto} or using a @code{case} or @code{default} label inside the statement expression is not permitted. Jumping into a statement expression with a computed @code{goto} (@pxref{Labels as Values}) has undefined behavior. +Taking the address of a label declared inside of a statement +expression from outside of the statement expression has undefined +behavior. Jumping out of a statement expression is permitted, but if the statement expression is part of a larger expression then it is unspecified which other subexpressions of that expression have been