This is a summary of discussions relative to the merge request created by Torbjörn Svensson (azoff) <[email protected]> titled analyzer: follow macro aliases for named constant [PR125265] since its creation.
Description: Ok for trunk? I'm unsure if this should also go into releases/gcc-16, WDYT? -- CC: David Malcolm <[email protected]> The full and up to date discussion can be found at https://forge.sourceware.org/gcc/gcc/pulls/226 The merge request has been closed without being merged directly on the forge repository. On 2026-10-05 23:55:41+00:00, David Malcolm (dmalcolm) <[email protected]> requested changes to the code: > +++ gcc/params.opt > @@ -33,1 +34,4 @@ > +Common Joined UInteger Var(param_analyzer_max_macro_alias_depth) Init(8) > IntegerRange(0, 255) > +Maximum number of macro aliases to follow when resolving named constants in > the analyzer; zero disables alias following. > + > -param=asan-globals= Thanks for adding the param. Please can you add documentation for it to `gcc/doc/params.texi`. > +++ gcc/params.opt > @@ -33,1 +34,4 @@ > +Common Joined UInteger Var(param_analyzer_max_macro_alias_depth) Init(8) > IntegerRange(0, 255) > +Maximum number of macro aliases to follow when resolving named constants in > the analyzer; zero disables alias following. > + > -param=asan-globals= Done in v3. On 2026-10-06 17:08:31+00:00, David Malcolm (dmalcolm) <[email protected]> approved the changes: Thanks; LGTM for trunk. Let's let it bake there for a bit before backporting. On 2026-10-06 17:18:35+00:00, Torbjörn Svensson (azoff) wrote: @dmalcolm wrote in https://forge.sourceware.org/gcc/gcc/pulls/226#issuecomment-7728: > Thanks; LGTM for trunk. Let's let it bake there for a bit before backporting. Should I leave this pull open until the backport is done or close it when I push to trunk? On 2026-10-07 16:15:21+00:00, Torbjörn Svensson (azoff) wrote: Linaro CI reported the following on v3: ``` | # build_abe bootstrap: | # FAILED | # First few build errors in logs: | # 00:35:00 /home/tcwg-build/workspace/tcwg_gnu_7/abe/snapshots/gcc.git~master/gcc/c/c-parser.cc:2038:19: error: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Werror=sign-compare] | # 00:36:33 make[3]: *** [Makefile:1229: c/c-parser.o] Error 1 | # 00:36:33 make[2]: *** [Makefile:5183: all-stage2-gcc] Error 2 | # 00:36:33 make[1]: *** [Makefile:26491: stage2-bubble] Error 2 | # 00:36:33 make: *** [Makefile:1139: all] Error 2 ``` To fix this, I made the following change in the version that I pushed as r17-4966-gbaea2a0be30d84: ```diff diff --git a/gcc/c/c-parser.cc b/gcc/c/c-parser.cc index e03c06da9a2..8aa4f54eb0d 100644 --- a/gcc/c/c-parser.cc +++ b/gcc/c/c-parser.cc @@ -2022,9 +2022,13 @@ private: as doing so would require a parser. Also handle the case where MACRO's definition is a single identifier that is itself a macro name (e.g. "#define O_CREAT _FCREAT"), by - following the chain of aliases up to MAX_ALIAS_DEPTH deep. */ - tree consider_macro (cpp_macro *macro, unsigned int depth = 0) const + following the chain of aliases. */ + tree consider_macro (cpp_macro *macro, int depth = 0) const { + /* UInteger option variables are stored as int, so "depth" must be signed + to avoid a signed/unsigned comparison here. */ + gcc_assert (depth >= 0); + if (macro->paramc > 0) return NULL_TREE; if (macro->kind != cmk_macro) ```
