Committed: fix PR middle-end/35595

Hans-Peter Nilsson hans-peter.nilsson@axis.com
Sat Mar 15 04:13:00 GMT 2008


See the PR.  One of Richi's recent changes broke the build for
cris-elf, compiling newlib.  Richi noted that the preprocessed
code also fails on native i686.  He quickly fixed the problem
and "preapproved" this patch pending testing.  Indeed it fixes
the build problem and no regressions remain, so committed, along
with a ChangeLog entry that I hope is obviously correct. :)

I autoreduced the preprocessed newlib code (FWIW, not delta but
a script I wrote some time ago) and made a test-case out of it,
one that that originally failed on cris-elf as well as native
x86_64-unknown-linux-gnu.

gcc:
	PR middle-end/35595
	* tree-ssa-pre.c (bitmap_find_leader): Handle expression
	being a PHI_NODE.

gcc/testsuite:
	PR middle-end/35595
	* gcc.c-torture/compile/pr35595.c: New test.	

Index: tree-ssa-pre.c
===================================================================
*** tree-ssa-pre.c	(revision 133224)
--- tree-ssa-pre.c	(working copy)
*************** bitmap_find_leader (bitmap_set_t set, tr
*** 1431,1437 ****
  	  if (stmt)
  	    {
  	      tree def_stmt = SSA_NAME_DEF_STMT (val);
! 	      if (bb_for_stmt (def_stmt) == bb_for_stmt (stmt)
  		  && stmt_ann (def_stmt)->uid >= stmt_ann (stmt)->uid)
  		continue;
  	    }
--- 1431,1438 ----
  	  if (stmt)
  	    {
  	      tree def_stmt = SSA_NAME_DEF_STMT (val);
! 	      if (TREE_CODE (def_stmt) != PHI_NODE
! 		  && bb_for_stmt (def_stmt) == bb_for_stmt (stmt)
  		  && stmt_ann (def_stmt)->uid >= stmt_ann (stmt)->uid)
  		continue;
  	    }


--- /dev/null	Tue Oct 29 15:57:07 2002
+++ gcc.c-torture/compile/pr35595.c	Sat Mar 15 01:46:43 2008
@@ -0,0 +1,59 @@
+/* { dg-require-effective-target int32plus } */
+typedef signed int __int32_t;
+typedef unsigned int __uint32_t;
+typedef union
+{
+  float value;
+  __uint32_t word;
+}
+ieee_float_shape_type;
+static const float two23 = 8.3886080000e+06;
+static const float pi = 3.1415927410e+00;
+static const float zero = 0.0000000000e+00;
+static float
+sin_pif (float x)
+{
+  float y = 0;
+  float z = 0;
+  __int32_t n = 0;
+  __int32_t ix = 0;
+  do
+    {
+      ieee_float_shape_type gf_u = { 0 };
+      (ix) = gf_u.word;
+    }
+  while (0);
+  if (z == y)
+    {
+      if (ix < 0x4b800000)
+	{
+	  if (ix < 0x4b000000)
+	    z = y + two23;
+	  do
+	    {
+	      ieee_float_shape_type gf_u;
+	      gf_u.value = (z);
+	      (n) = gf_u.word;
+	    }
+	  while (0);
+	}
+    }
+  if (n == 0)
+    y = __kernel_sinf (pi * y, zero, 0);
+}
+
+float
+__ieee754_lgammaf_r (float x, int *signgamp)
+{
+  float t = 0;
+  __int32_t hx = 0;
+  do
+    {
+      ieee_float_shape_type gf_u = { 0 };
+      (hx) = gf_u.word;
+    }
+  while (0);
+  if (hx < 0)
+    t = sin_pif (x);
+  return 0;
+}

brgds, H-P



More information about the Gcc-patches mailing list