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]
Other format: [Raw text]

[PATCH] Fix find_base_term


Hi!

The http://gcc.gnu.org/ml/gcc-patches/2008-11/msg01402.html
patch IMHO broke CONST (PLUS) and CONST (MINUS) handling
in find_base_term.  Before that change, the CONST case just
fell through to the PLUS/MINUS (and at that time LO_SUM as well)
case, but now it falls through to the LO_SUM case which just considers
the second operand, not the first (but CONST had a PLUS or MINUS
in it, not LO_SUM).  I don't have a testcase that broke because of
this, the bug was found by accident when looking at the function.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for
trunk and 4.4?

2009-04-22  Jakub Jelinek  <jakub@redhat.com>

	* alias.c (find_base_term): Move around LO_SUM case, so that
	CONST falls through into PLUS/MINUS handling.

--- gcc/alias.c.jj	2009-04-21 11:16:28.000000000 +0200
+++ gcc/alias.c	2009-04-21 12:44:18.000000000 +0200
@@ -1438,15 +1438,16 @@ find_base_term (rtx x)
 	  return x;
       return 0;
 
+    case LO_SUM:
+      /* The standard form is (lo_sum reg sym) so look only at the
+         second operand.  */
+      return find_base_term (XEXP (x, 1));
+
     case CONST:
       x = XEXP (x, 0);
       if (GET_CODE (x) != PLUS && GET_CODE (x) != MINUS)
 	return 0;
       /* Fall through.  */
-    case LO_SUM:
-      /* The standard form is (lo_sum reg sym) so look only at the
-         second operand.  */
-      return find_base_term (XEXP (x, 1));
     case PLUS:
     case MINUS:
       {

	Jakub


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