https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106080

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Marek Polacek from comment #3)
> I don't think we should be warning here at all and I have a patch to that
> effect.

I also disagree with the saying we should not be warning here. Address to
lables are undefined once they leave the function scope (or in the case of
statement expressions; out of the statement expression scope). We even document
that.

https://gcc.gnu.org/onlinedocs/gcc-12.2.0/gcc/Labels-as-Values.html#Labels-as-Values

> You may not use this mechanism to jump to code in a different function. If 
> you do that, totally unpredictable things happen. The best way to avoid this 
> is to store the label address only in automatic variables and never pass it 
> as an argument.

We should be warning about this case just because of the above wording in the
documentation.

Reply via email to