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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2025-09-13
     Ever confirmed|0                           |1

--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to uecker from comment #5)
> The patch sets DECL_NONLOCAL on label which was not done before.  The
> following patch which I am testing right now fixes this.  I can not comment
> on whether there is also an underlying bug exposed by this or not.
> 
> diff --git a/gcc/c/c-typeck.cc b/gcc/c/c-typeck.cc
> index 67e4c9cfa57..396224f6ad6 100644
> --- a/gcc/c/c-typeck.cc
> +++ b/gcc/c/c-typeck.cc
> @@ -3681,7 +3681,8 @@ mark_decl_used (tree ref, bool address)
>    if (static_p)
>      C_DECL_USED (ref) = 1;
>  
> -  if (nonloc_p)
> +  if (nonloc_p && (VAR_OR_FUNCTION_DECL_P (ref)
> +                || PARM_DECL == TREE_CODE (ref)))
>      DECL_NONLOCAL (ref) = 1;
>  
>    /* Nothing to do anymore.  */

That works too.

Reply via email to