https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105630
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> ---
Ah, the difference between this and PR105415 is that here the VAR_DECL n has
DECL_RTL set, so we don't go through
/* This decl was probably optimized away. */
if (!op0
/* At least label RTXen are sometimes replaced by
NOTE_INSN_DELETED_LABEL. Any notes here are not
handled by copy_rtx. */
|| NOTE_P (op0))
{
if (!VAR_P (exp)
|| DECL_EXTERNAL (exp)
|| !TREE_STATIC (exp)
|| !DECL_NAME (exp)
|| DECL_HARD_REGISTER (exp)
|| DECL_IN_CONSTANT_POOL (exp)
|| mode == VOIDmode
|| symtab_node::get (exp) == NULL)
return NULL;
op0 = make_decl_rtl_for_debug (exp);
if (!MEM_P (op0)
|| GET_CODE (XEXP (op0, 0)) != SYMBOL_REF
|| SYMBOL_REF_DECL (XEXP (op0, 0)) != exp)
return NULL;
}
because op0 is non-NULL, so we go with
else
op0 = copy_rtx (op0);
instead.
So perhaps something like:
else if (VAR_P (exp)
&& is_global_var (exp)
&& symtab_node::get (exp) == NULL)
return NULL;
before the else or so?
But, we'll need to compare the effects on debug info with that change too.