https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63546

Jan Hubicka <hubicka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-10-16
                 CC|                            |ccoutant at google dot com,
                   |                            |jakub at redhat dot com,
                   |                            |jason at redhat dot com
     Ever confirmed|0                           |1

--- Comment #3 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
OK, the problem seems to be that dwarf2out tries to produce RTL for a variable
that is optimized out.  This happens here:

  /* Try harder to get a rtl.  If this symbol ends up not being emitted
     in the current CU, resolve_addr will remove the expression referencing
     it.  */
  if (rtl == NULL_RTX
      && TREE_CODE (decl) == VAR_DECL
      && !DECL_EXTERNAL (decl)
      && TREE_STATIC (decl)
      && DECL_NAME (decl)
      && !DECL_HARD_REGISTER (decl)
      && DECL_MODE (decl) != VOIDmode)
    {
      rtl = make_decl_rtl_for_debug (decl);
      if (!MEM_P (rtl)
          || GET_CODE (XEXP (rtl, 0)) != SYMBOL_REF
          || SYMBOL_REF_DECL (XEXP (rtl, 0)) != decl)
        rtl = NULL_RTX;
    }

producing RTL brings the function in, because it wants to work out its section
that breaks. I do not think dwarf2out really needs RTL for variable that was
never output.

Shall we kludge around and make make_decl_rtl-for_debug to not ICE but return
sort of random RTL or shall we just prevent this path with reference_to_unused
check?

For Martin and Trevor, I think safe workaround is to just comment out this
path.

Reply via email to