This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Reload finds invalid class


I think I have found a problem in reload.c:find_valid_class(), which
only shows up for small register classes.

The particular example I have is it is called with m1=SImode, n=1,
dest_regno=18 and I have a sub-class of floating point registers
with a size of just one.

The one register floating point class is found even though it is a)
too small and b) not OK for SImode.

In the following code:

      for (regno = 0; regno < FIRST_PSEUDO_REGISTER && ! bad; regno++)
	if (TEST_HARD_REG_BIT (reg_class_contents[class], regno)
	    && TEST_HARD_REG_BIT (reg_class_contents[class], regno + n)
	    && ! HARD_REGNO_MODE_OK (regno + n, m1))
	  bad = 1;

HARD_REGNO_MODE_OK (regno + n, m1) will be evaluated at least once, so
long as the class is at size of at least (n + 1), but if the class is
smaller than that, it will be never checked if it is OK for mode.

I think inserting and extra test:

      if (reg_class_size[class] < (n + 1))
	continue;

solves the problem.

Is my analysis correct? If so I will submit a patch.

Ian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]