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

--- Comment #7 from Sandra Loosemore <sandra at codesourcery dot com> ---
Hmmmm.  I'm not sure why there's trouble in reproducing the failure, but
looking at this some more, it seems like we have a problem with this code
fragment from force_const_mem in varasm.c:

  /* If we're not allowed to drop X into the constant pool, don't.  */
  if (targetm.cannot_force_const_mem (mode, x))
    return NULL_RTX;

and the code at the call site in plus_constant in explow.c:

      tem = force_const_mem (GET_MODE (x), tem);
      if (memory_address_p (GET_MODE (tem), XEXP (tem, 0)))
        return tem;

which is clearly not expecting force_const_mem to return null.  Guarding the
reference in the conditional like

      if (tem && memory_address_p (GET_MODE (tem), XEXP (tem, 0))) ...

fixes the SEGV, but a quick look shows that there are a lot of other uses of
force_const_mem that expect it to return a non-null value, with no checking.  
So, probably this has nothing to do with the specific change in r217852, but
has been a lurking bug for a long time, and it needs more than a band-aid on
this one particular call site.

Reply via email to