[Bug rtl-optimization/21144] [4.0/4.1 regression] Apparent infinite loop in reload
matz at suse dot de
gcc-bugzilla@gcc.gnu.org
Mon Apr 25 13:20:00 GMT 2005
------- Additional Comments From matz at suse dot de 2005-04-25 13:20 -------
The problem is in reload_cse_move2add. It has such a loop:
for (narrow_mode = GET_CLASS_NARROWEST_MODE (MODE_INT);
narrow_mode != GET_MODE (reg);
narrow_mode = GET_MODE_WIDER_MODE (narrow_mode))
{
where 'reg' comes from a simple SET insn. In this testcase the insn is:
(set (reg:BI r15) (const_int 1))
note the mode of reg being BImode. Now, BImode is in fact a
FRACTIONAL_INT_MODE, not an INT_MODE (although GET_MODE_CLASS would
return INT_MODE, so using this instead of hard-coded INT_MODE wouldn't help).
And GET_CLASS_NARROWEST_MODE(INT_MODE) is QImode, as it will ignore modes
with precision 1 bit in genmodes.c (I think because the rest of the compiler
is not prepared to really see an BImode here, but I may be wrong, there
are not that many instance of GET_CLASS_NARROWEST_MODE and most look safe,
but will iterate one more time uselessly if started from BImode).
So, this loop starts with QImode, widens the mode each time, and waits for
it to become equal to the mode of 'reg', i.e. BImode. This of course
never happens, so somewhen it is VOIDmode, and that's the fixed point
of GET_CLASS_NARROWEST_MODE. So we are endlessly looping.
I've attached the obvious change, which I'm going to regtest now. It fixes
this testcase.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21144
More information about the Gcc-bugs
mailing list