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 a recent bootstrap failure on sparc-sun-solaris2.8.


Hi,

Attached is a patch to fix the bootstrap failure recently reported on
sparc-sun-solaris2.8.  The problem was introduced by

http://gcc.gnu.org/ml/gcc-patches/2003-07/msg01358.html

The above patch adds a seemingly innocent conversion from

  (ne (and (not X) 1) 0)

to

  (eq (and X 1) 0).

I rely on simplify_and_const_int() to construct (and X 1).  Since I
pass the original and expression, the function tries to reuse the and
expression and replace its operands, causing a rtx sharing problem.
Specifically, if there is another simplification going on at the same
time (because of the recursive nature of combine_simplify_rtx()), and
that simplification was on an expression containing (and (not X) 1) as
a subexpression, simplify_and_const_int() quietly drops the not
appearing in the and expression.

The patch fixes the problem by asking simplify_and_const_int() to
always create an and expression.

Thanks to Andreas Tobler and Rainer Orth, the patch is reported to
allow gcc bootstrap again on the port and cause no new regressions.

Committed as obvious.

Kazu Hirata

2003-07-18  Kazu Hirata  <kazu@cs.umass.edu>

	* combine.c (simplify_comparison): Don't share rtx when converting 
	(ne (and (not X) 1) 0) to (eq (and X 1) 0).

Index: combine.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/combine.c,v
retrieving revision 1.371
diff -u -r1.371 combine.c
--- combine.c	18 Jul 2003 18:23:30 -0000	1.371
+++ combine.c	18 Jul 2003 21:27:39 -0000
@@ -11072,7 +11072,7 @@
 	      && GET_CODE (XEXP (op0, 0)) == NOT)
 	    {
 	      op0 = simplify_and_const_int
-		(op0, mode, XEXP (XEXP (op0, 0), 0), (HOST_WIDE_INT) 1);
+		(NULL_RTX, mode, XEXP (XEXP (op0, 0), 0), (HOST_WIDE_INT) 1);
 	      code = (code == NE ? EQ : NE);
 	      continue;
 	    }


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