http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54041

Mikael Pettersson <mikpe at it dot uu.se> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mikpe at it dot uu.se

--- Comment #3 from Mikael Pettersson <mikpe at it dot uu.se> 2012-07-20 
10:22:03 UTC ---
Was this originally seen with an out-of-tree port?

m68k-linux-gcc -mshort is an unusual combination, and I would expect it to be
essentially unsupported as -mshort changes the ABI.  For m68k-elf the option
might make sense, but I wasn't able to reproduce the ICE for m68k-elf, only
m68k-linux.

The ICE comes from explow.c:

rtx
convert_memory_address_addr_space (enum machine_mode to_mode ATTRIBUTE_UNUSED,
                                   rtx x, addr_space_t as ATTRIBUTE_UNUSED)
{
#ifndef POINTERS_EXTEND_UNSIGNED
  gcc_assert (GET_MODE (x) == to_mode || GET_MODE (x) == VOIDmode);
  return x;
#else /* defined(POINTERS_EXTEND_UNSIGNED) */

m68k doesn't define P_E_U, but with -mshort to_mode apparently ends up being
shorter, so the above assertion fails.

The documentation for P_E_U states:

"
You need not define this macro if the @code{ptr_mode}, @code{Pmode}
and @code{word_mode} are all the same width.
"

-mshort changes word_mode, invalidating the condition for not defining P_E_U.

In this case a truncation is asked for.  convert_memory_address_addr_space does
perform truncations, but only when P_E_U is defined.  Defining P_E_U to 0
around c_m_a_a_s eliminated the ICE and generated reasonable-looking code.

I'm not sure if the bug is that the m68k backend doesn't define P_E_U even
though is permits -mshort, or that c_m_a_a_s is wrong and should perform
truncations also when P_E_U is undefined.

Reply via email to