[PATCH] Fix PR43379

H.J. Lu hjl.tools@gmail.com
Tue Mar 16 22:06:00 GMT 2010


On Tue, Mar 16, 2010 at 1:08 PM, Joseph S. Myers
<joseph@codesourcery.com> wrote:
> On Tue, 16 Mar 2010, H.J. Lu wrote:
>
>> We are warning return of label as local variable. This patch fixes it,.
>
> Are you sure this is a bug?  Returning the address of a local label seems
> exactly as problematic as returning the address of a local variable; the
> diagnostic should say "label" not "variable", and it should be possible to
> disable it, but the uses of doing so are fairly specialized and
> non-portable in both cases (reporting addresses of particular code in a
> function, or of a stack location from a function call); you can't jump to
> the returned address of a label, or dereference the returned address of a
> variable.
>

Well, I thought the warning is here because the address of a local variable
will become invalid after function return. Label doesn't have such an issue.
In any case, the warning doesn't make much senses for label.

-- 
H.J.



More information about the Gcc-patches mailing list