https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94223
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> --- gimplify.c does: 4941 if (!DECL_NAME (object)) 4942 DECL_NAME (object) = create_tmp_var_name ("C"); 4943 walk_tree (&DECL_INITIAL (object), force_labels_r, NULL, NULL); 4944 4945 /* ??? C++ doesn't automatically append a .<number> to the 4946 assembler name, and even when it does, it looks at FE private 4947 data structures to figure out what that number should be, 4948 which are not set for this variable. I suppose this is 4949 important for local statics for inline functions, which aren't 4950 "local" in the object file sense. So in order to get a unique 4951 TU-local symbol, we must invoke the lhd version now. */ 4952 lhd_set_decl_assembler_name (object); and lhd_set_decl_assembler_name does: 169 const char *name = IDENTIFIER_POINTER (DECL_NAME (decl)); 170 char *label; 171 172 ASM_FORMAT_PRIVATE_NAME (label, name, DECL_UID (decl)); 173 id = get_identifier (label); The problem is that DECL_UID isn't stable across -fcompare-debug, we only guarantee that the comparisons of the DECL_UIDs are the same between corresponding decls, but -g can have larger gaps. grep ASM_FORMAT_PRIVATE_NAME.*DECL_UID * */* config/*/* 2>/dev/null langhooks.c: ASM_FORMAT_PRIVATE_NAME (label, name, DECL_UID (decl)); d/decl.cc: ASM_FORMAT_PRIVATE_NAME (label, name, DECL_UID (decl)); lto/lto-lang.c: ASM_FORMAT_PRIVATE_NAME (label, name, DECL_UID (decl)); Not sure what to do, shall we have some GTY counter used for these instead of DECL_UID which we'd bump when we've done this?