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]

[3.3] Fix PR optimization/11662


Hi,

This is a regression from GCC 3.0.4, present on the 3.3 branch on SPARC 
machines. The combiner is again the culprit, because it doesn't correctly 
propagate an error indicator.

More specifically, simplify_shift_const calls gen_lowpart_for_combine to 
generate an ASHIFT of a SImode pseudo in DImode. The latter function returns 
the error indicator (clobber (const_int 0)), which is then passed to 
gen_binary. But gen_binary doesn't know of this indicator and uses it to 
build a binary operation.

This has already been fixed on mainline so the patch is a backport. 
Bootstrapped/regtested on i586-redhat-linux-gnu (3.3 branch except Ada).


2003-09-07  Christian Ehrhardt <ehrhardt@mathematik.uni-ulm.de>

	PR optimization/11662
	Backport from mainline:

	2003-07-10  Denis Chertykov  <denisc@overta.ru>
                    Richard Kenner <kenner@vlsi1.ultra.nyu.edu>

        * combine.c (gen_binary): Handle the CLOBBER rtx and
        don't build a binary operation with it.


2003-09-07  Eric Botcazou  <ebotcazou@libertysurf.fr>

	* gcc.c-torture/execute/20030907-1.c: New test


-- 
Eric Botcazou
Index: combine.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/combine.c,v
retrieving revision 1.367
retrieving revision 1.368
diff -u -p -r1.367 -r1.368
--- combine.c	5 Jul 2003 21:10:08 -0000	1.367
+++ combine.c	10 Jul 2003 20:28:09 -0000	1.368
@@ -10171,6 +10171,11 @@ gen_binary (enum rtx_code code, enum mac
   rtx result;
   rtx tem;
 
+  if (GET_CODE (op0) == CLOBBER)
+    return op0;
+  else if (GET_CODE (op1) == CLOBBER)
+    return op1;
+  
   if (GET_RTX_CLASS (code) == 'c'
       && swap_commutative_operands_p (op0, op1))
     tem = op0, op0 = op1, op1 = tem;
/* PR optimization/11662 */
/* Origin: heinrich.brand@fujitsu-siemens.com */

/* This used to fail on SPARC at -O1 because the combiner didn't
   correctly propagate an error indicator.  */

unsigned long long r;

void test(unsigned long a, unsigned long b, unsigned long long c)
{
  r = (a^b)&c;
}

int main()
{
  test(1,2,3);

  if (r != 3)
    abort();

  return 0;
} 

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