]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR rtl-optimization/38281 (segmentation fault with optimization enabled)
authorEric Botcazou <ebotcazou@adacore.com>
Wed, 3 Dec 2008 08:40:50 +0000 (08:40 +0000)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Wed, 3 Dec 2008 08:40:50 +0000 (08:40 +0000)
PR rtl-optimization/38281
* combine.c (distribute_notes): When invoking SET_INSN_DELETED on i2,
set it to NULL_RTX afterwards.

* emit-rtl.c (set_insn_deleted): Fix formatting.

Co-Authored-By: Andrew Pinski <andrew_pinski@playstation.sony.com>
Co-Authored-By: Jakub Jelinek <jakub@redhat.com>
From-SVN: r142388

gcc/ChangeLog
gcc/combine.c
gcc/emit-rtl.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/20081203-1.c [new file with mode: 0644]

index 6ee8dd848c59b197e57d8f84a811f0d70baa6042..a4afc7ebbd9e4e6fc6ed859dd265bc574c1b1903 100644 (file)
@@ -1,3 +1,13 @@
+2008-12-03  Eric Botcazou  <ebotcazou@adacore.com>
+            Jakub Jelinek  <jakub@redhat.com>
+            Andrew Pinski  <andrew_pinski@playstation.sony.com>
+
+       PR rtl-optimization/38281
+       * combine.c (distribute_notes): When invoking SET_INSN_DELETED on i2,
+       set it to NULL_RTX afterwards.
+
+       * emit-rtl.c (set_insn_deleted): Fix formatting.
+
 2008-12-02  Richard Sandiford  <rdsandiford@googlemail.com>
 
        * config/mips/mips.c (mips_expand_builtin): Fix the mode of the
index b8a43356b461e2a9d9a678075b07a4da61acf1cb..d6f7480223aaa96ccf30f9ec22254c2ebe8beb8c 100644 (file)
@@ -12653,6 +12653,8 @@ distribute_notes (rtx notes, rtx from_insn, rtx i3, rtx i2, rtx elim_i2,
                          distribute_links (LOG_LINKS (tem));
 
                          SET_INSN_DELETED (tem);
+                         if (tem == i2)
+                           i2 = NULL_RTX;
 
 #ifdef HAVE_cc0
                          /* Delete the setter too.  */
@@ -12668,6 +12670,8 @@ distribute_notes (rtx notes, rtx from_insn, rtx i3, rtx i2, rtx elim_i2,
                              distribute_links (LOG_LINKS (cc0_setter));
 
                              SET_INSN_DELETED (cc0_setter);
+                             if (cc0_setter == i2)
+                               i2 = NULL_RTX;
                            }
 #endif
                        }
index ced4e58b160623f4e547f6a6ed170aa3a0228bf5..0738f384497ed5a36d7e30cf571c86f812455e9d 100644 (file)
@@ -3620,7 +3620,8 @@ add_insn_before (rtx insn, rtx before, basic_block bb)
 
 /* Replace insn with an deleted instruction note.  */
 
-void set_insn_deleted (rtx insn)
+void
+set_insn_deleted (rtx insn)
 {
   df_insn_delete (BLOCK_FOR_INSN (insn), INSN_UID (insn));
   PUT_CODE (insn, NOTE);
index 6d585a6ef25530fdb1f6c38eb99e89d660670f28..a1623c9be97ceceffb7679fdfe9dfaf014a4b9ca 100644 (file)
@@ -1,3 +1,7 @@
+2008-12-03  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * gcc.c-torture/compile/20081203-1.c: New test.
+
 2008-12-02  Jason Merrill  <jason@redhat.com>
 
        PR c++/35782, c++/37860
diff --git a/gcc/testsuite/gcc.c-torture/compile/20081203-1.c b/gcc/testsuite/gcc.c-torture/compile/20081203-1.c
new file mode 100644 (file)
index 0000000..713235f
--- /dev/null
@@ -0,0 +1,24 @@
+/* PR rtl-optimization/38281 */
+/* Reporter: John Regehr <regehr@cs.utah.edu> */
+/* Testcase by Jakub Jelinek <jakub@redhat.com> */
+
+inline unsigned short
+foo (unsigned short x, unsigned short y)
+{
+  if (y == 0)
+    return x;
+  return x / y;
+}
+
+unsigned short a, b, c;
+
+extern int baz (int, int);
+
+void
+bar (void)
+{
+  int d = 0x3D75D162;
+  a = foo (b > d, baz (0, 1));
+  for (c = 0; c; c = 1)
+    ;
+}