]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR middle-end/59743 (ICE: Segmentation fault)
authorJeff Law <law@redhat.com>
Fri, 10 Jan 2014 22:13:18 +0000 (15:13 -0700)
committerJeff Law <law@gcc.gnu.org>
Fri, 10 Jan 2014 22:13:18 +0000 (15:13 -0700)
PR middle-end/59743
* ree.c (combine_reaching_defs): Ensure the defining statement
occurs before the extension when optimizing extensions with
different source and destination hard registers.

PR middle-end/59743
* gcc.c-torture/compile/pr59743.c: New test.

From-SVN: r206545

gcc/ChangeLog
gcc/ree.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/pr59743.c [new file with mode: 0644]

index 54d62608a9439612506a8a91cd8bc335c8c67955..c554609e7b7d189ab5b139840d9bb26ac330aed1 100644 (file)
@@ -1,3 +1,10 @@
+2014-01-10  Jeff Law  <law@redhat.com>
+
+       PR middle-end/59743
+       * ree.c (combine_reaching_defs): Ensure the defining statement
+       occurs before the extension when optimizing extensions with
+       different source and destination hard registers.
+
 2014-01-10  Jan Hubicka  <jh@suse.cz>
 
        PR ipa/58585
index 01ccd6996266eff643984cb1e75e1f660fcb7924..63cc8cc7c32eaebda88bc664ec369f4fdf96aecc 100644 (file)
--- a/gcc/ree.c
+++ b/gcc/ree.c
@@ -723,8 +723,10 @@ combine_reaching_defs (ext_cand *cand, const_rtx set_pat, ext_state *state)
 
       /* The defining statement and candidate insn must be in the same block.
         This is merely to keep the test for safety and updating the insn
-        stream simple.  */
-      if (BLOCK_FOR_INSN (cand->insn) != BLOCK_FOR_INSN (def_insn))
+        stream simple.  Also ensure that within the block the candidate
+        follows the defining insn.  */
+      if (BLOCK_FOR_INSN (cand->insn) != BLOCK_FOR_INSN (def_insn)
+         || DF_INSN_LUID (def_insn) > DF_INSN_LUID (cand->insn))
        return false;
 
       /* If there is an overlap between the destination of DEF_INSN and
index 4373d0ffcc29010a2dc01f51a1ffa374e5c7e8ed..f40d56ed2c77c16c49f37166704bc43befd51752 100644 (file)
@@ -1,3 +1,8 @@
+2014-01-10  Jeff Law  <law@redhat.com>
+
+       PR middle-end/59743
+       * gcc.c-torture/compile/pr59743.c: New test.
+
 2014-01-10  Jan Hubicka  <jh@suse.cz>
 
        PR ipa/58585
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr59743.c b/gcc/testsuite/gcc.c-torture/compile/pr59743.c
new file mode 100644 (file)
index 0000000..8dadba5
--- /dev/null
@@ -0,0 +1,23 @@
+/* PR middle-end/59743 */
+
+typedef union {
+  long all;
+  struct {
+    int low;
+    int high;
+  } s;
+} udwords;
+int a, b, c, d;
+void __udivmoddi4() {
+  udwords r;
+  d = __builtin_clz(0);
+  r.s.low = 0;
+  for (; d; --d) {
+    r.s.high = r.s.high << 1 | r.s.low >> a;
+    r.s.low = r.s.low << b >> 1;
+    int s = -r.all;
+    c = s;
+    r.all--;
+  }
+}
+