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

uecker at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |uecker at gcc dot gnu.org

--- Comment #5 from uecker at gcc dot gnu.org ---
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.  */

Reply via email to