https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127991
--- Comment #6 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-16 branch has been updated by Gaius Mulley <[email protected]>: https://gcc.gnu.org/g:584d2bc707b31f1078b4aea6cb840fa85bab58b7 commit r16-9959-g584d2bc707b31f1078b4aea6cb840fa85bab58b7 Author: Gaius Mulley <[email protected]> Date: Fri Nov 13 23:47:06 2026 +0000 PR modula2/127991: Fix tree-dump crash on anonymous constants m2decl_DeclareKnownConstant creates an IDENTIFIER_NODE without setting its string, even though the constant is intended to be anonymous. Tree dumps treat the nonnull DECL_NAME as printable and dereference its null string, causing a crash for anonymous set constants. Build the CONST_DECL with a NULL_TREE name instead. The dumper then uses the declaration's generated name. Add a dump regression test. The test case was found by a non-AI automated testing tool. The investigation was assisted by OpenAI Codex 5.6 Sol and Claude. gcc/m2/ChangeLog: PR modula2/127991 * gm2-gcc/m2decl.cc (m2decl_DeclareKnownConstant): Build the anonymous constant declaration without a name. gcc/testsuite/ChangeLog: PR modula2/127991 * gm2.dg/dump/pim/pass/anonymousconst.mod: New test. * gm2.dg/dump/pim/pass/dg-dump-pim-pass.exp: New test. Authored-by: Yongqiang Tian <[email protected]> (cherry picked from commit 5a696df0da45397886341fee4618720384798259) Signed-off-by: Gaius Mulley <[email protected]>
