Blame SOURCES/gcc32-null-pointer-check-noncc0.patch

4ac4fd
2004-02-26  Alan Modra  <amodra@bigpond.net.au>
4ac4fd
4ac4fd
	PR rtl-optimization/14279
4ac4fd
	* gcse.c (delete_null_pointer_checks_1): Do not delete CC setter
4ac4fd
	unless HAVE_cc0.
4ac4fd
4ac4fd
2004-12-22  Jakub Jelinek  <jakub@redhat.com>
4ac4fd
4ac4fd
	* gcc.c-torture/execute/20041222-1.c: New test.
4ac4fd
4ac4fd
--- gcc/gcse.c.jj	2003-03-10 17:42:09.000000000 +0100
4ac4fd
+++ gcc/gcse.c	2004-12-22 12:03:32.272762070 +0100
4ac4fd
@@ -5428,8 +5428,10 @@ delete_null_pointer_checks_1 (block_reg,
4ac4fd
 	}
4ac4fd
 
4ac4fd
       delete_insn (last_insn);
4ac4fd
+#ifdef HAVE_cc0
4ac4fd
       if (compare_and_branch == 2)
4ac4fd
         delete_insn (earliest);
4ac4fd
+#endif
4ac4fd
       purge_dead_edges (BASIC_BLOCK (bb));
4ac4fd
 
4ac4fd
       /* Don't check this block again.  (Note that BLOCK_END is
4ac4fd
--- gcc/testsuite/gcc.c-torture/execute/20041222-1.c.jj	2004-12-22 12:07:50.446611220 +0100
4ac4fd
+++ gcc/testsuite/gcc.c-torture/execute/20041222-1.c	2004-12-22 11:34:45.000000000 +0100
4ac4fd
@@ -0,0 +1,41 @@
4ac4fd
+extern void abort (void);
4ac4fd
+extern void exit (int);
4ac4fd
+
4ac4fd
+struct S
4ac4fd
+{
4ac4fd
+  void *a;
4ac4fd
+  unsigned int b;
4ac4fd
+};
4ac4fd
+
4ac4fd
+void
4ac4fd
+__attribute__((noinline))
4ac4fd
+bar (struct S *x)
4ac4fd
+{
4ac4fd
+  if (x->b != 2)
4ac4fd
+    abort ();
4ac4fd
+}
4ac4fd
+
4ac4fd
+void
4ac4fd
+__attribute__((noinline))
4ac4fd
+foo (struct S *x)
4ac4fd
+{
4ac4fd
+  if (! x->a)
4ac4fd
+    {
4ac4fd
+      struct S *y, *z;
4ac4fd
+      y = x;
4ac4fd
+      if (y)
4ac4fd
+	++y->b;
4ac4fd
+      z = x;
4ac4fd
+      if (z)
4ac4fd
+	++z->b;
4ac4fd
+      bar (x);
4ac4fd
+    }
4ac4fd
+}
4ac4fd
+
4ac4fd
+int
4ac4fd
+main (void)
4ac4fd
+{
4ac4fd
+  struct S s = { 0, 0 };
4ac4fd
+  foo (&s);
4ac4fd
+  exit (0);
4ac4fd
+}