This is the mail archive of the gcc-patches@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]

i386 legitimate_address_p tweek


I encountered a case today where cse2 generated what became

	movb  %al,55(%ebx,%al)

It seems we were not verifying that the modes of the base
and index registers.  I've committed the trivial patch.


r~


        * i386.c (legitimate_address_p): Verify modes of base and index.

Index: i386.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gcc/config/i386/i386.c,v
retrieving revision 1.74.12.5
diff -c -p -d -r1.74.12.5 i386.c
*** i386.c	1999/02/13 10:08:12	1.74.12.5
--- i386.c	1999/02/15 06:52:48
*************** legitimate_address_p (mode, addr, strict
*** 1563,1569 ****
      }
  
    if (GET_CODE (addr) == REG || GET_CODE (addr) == SUBREG)
!       base = addr;
  
    else if (GET_CODE (addr) == PLUS)
      {
--- 1563,1569 ----
      }
  
    if (GET_CODE (addr) == REG || GET_CODE (addr) == SUBREG)
!     base = addr;
  
    else if (GET_CODE (addr) == PLUS)
      {
*************** legitimate_address_p (mode, addr, strict
*** 1653,1658 ****
--- 1653,1664 ----
  	  return FALSE;
  	}
  
+       if (GET_MODE (base) != Pmode)
+ 	{
+ 	  ADDR_INVALID ("Base is not in Pmode.\n", base);
+ 	  return FALSE;
+ 	}
+ 
        if ((strict && ! REG_OK_FOR_BASE_STRICT_P (base))
  	  || (! strict && ! REG_OK_FOR_BASE_NONSTRICT_P (base)))
  	{
*************** legitimate_address_p (mode, addr, strict
*** 1671,1676 ****
--- 1677,1688 ----
        if (GET_CODE (indx) != REG)
  	{
  	  ADDR_INVALID ("Index is not a register.\n", indx);
+ 	  return FALSE;
+ 	}
+ 
+       if (GET_MODE (indx) != Pmode)
+ 	{
+ 	  ADDR_INVALID ("Index is not in Pmode.\n", indx);
  	  return FALSE;
  	}
  


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