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

Re: optimization/8165: builtin string functions SEGV on alpha-pc-linux-gnu at -O2


The following reply was made to PR optimization/8165; it has been noted by GNATS.

From: Glen Nakamura <glen@imodulo.com>
To: gcc-gnats@gcc.gnu.org, gcc-bugs@gcc.gnu.org
Cc:  
Subject: Re: optimization/8165: builtin string functions SEGV on alpha-pc-linux-gnu at -O2
Date: Mon, 7 Oct 2002 15:24:09 -1000

 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8165
 
 Okay, I think the problem is in the gcse pass.
 When we replace a register, we don't completely replace its references
 in the instruction's REG_EQUAL note.  Specifically, we miss the case
 where the register is referred to in a (lo_sum (reg) (symbol_ref)).
 My proposed fix is to add this case to simplify_replace_rtx() which is
 called by try_replace_reg() during the gcse pass.
 
 
 2002-10-07  Glen Nakamura  <glen@imodulo.com>
 
 	* simplify-rtx.c (simplify_replace_rtx): Added case to simplify
 	and replace LO_SUM expressions.
 
 Index: gcc/simplify-rtx.c
 ===================================================================
 RCS file: /cvsroot/gcc/gcc/gcc/simplify-rtx.c,v
 retrieving revision 1.122
 diff -c -5 -p -r1.122 simplify-rtx.c
 *** gcc/simplify-rtx.c	27 Sep 2002 12:48:02 -0000	1.122
 --- gcc/simplify-rtx.c	8 Oct 2002 00:41:55 -0000
 *************** simplify_replace_rtx (x, old, new)
 *** 339,348 ****
 --- 339,364 ----
         if (code == MEM)
   	return replace_equiv_address_nv (x,
   					 simplify_replace_rtx (XEXP (x, 0),
   							       old, new));
   
 +       if (code == LO_SUM)
 + 	{
 + 	  if (REG_P (old) && REG_P (XEXP (x, 0))
 + 	      && REGNO (old) == REGNO (XEXP (x, 0)))
 + 	    {
 + 	      if (REG_P (new))
 + 		return gen_rtx_fmt_ee (code, mode, new, XEXP (x, 1));
 + 
 + 	      /* (lo_sum (high X) X) is simply X.  */
 + 	      if (GET_CODE (new) == HIGH
 + 		  && rtx_equal_p (XEXP (new, 0), XEXP (x, 1)))
 + 		return XEXP (x, 1);
 + 	    }
 + 	  return x;
 + 	}
 + 
         if (REG_P (x) && REG_P (old) && REGNO (x) == REGNO (old))
   	return new;
   
         return x;
   


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