From: Martin Uecker Date: Sat, 13 Sep 2025 06:37:32 +0000 (+0200) Subject: c: Fix regression related to DECL_NONLOCAL on aarch64 [PR121933] X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4c1d8818dee177b4f6c3adbf747873a0443d02b6;p=thirdparty%2Fgcc.git c: Fix regression related to DECL_NONLOCAL on aarch64 [PR121933] The recent patch r16-3747-gafa74d37e81 to detect the use of non-local context by nested functions caused regressions on aarch64, because DECL_NONLOCAL was set on labels. Fix this by setting it only to the same types of decls as before. PR target/121933 gcc/c/ChangeLog: * c-typeck.cc (mark_decl_used): Set DECL_NONLOCAL only for VAR_DECL, FUNC_DECL, PARM_DECL. --- diff --git a/gcc/c/c-typeck.cc b/gcc/c/c-typeck.cc index b96215adc76..9b2aeea50f4 100644 --- a/gcc/c/c-typeck.cc +++ b/gcc/c/c-typeck.cc @@ -3696,7 +3696,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) + || TREE_CODE (ref) == PARM_DECL)) DECL_NONLOCAL (ref) = 1; /* Nothing to do anymore. */