re PR rtl-optimization/38774 (ice in df_refs_verify, at df-scan.c:4307)
authorJakub Jelinek <jakub@redhat.com>
Tue, 13 Jan 2009 22:36:06 +0000 (23:36 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 13 Jan 2009 22:36:06 +0000 (23:36 +0100)
PR rtl-optimization/38774
* combine.c (simplify_set): When undoing cc_use change, don't do
PUT_CODE on the newly created comparison, but instead put back the
old comparison.

* gcc.dg/torture/pr38774.c: New test.

From-SVN: r143355

gcc/ChangeLog
gcc/combine.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr38774.c [new file with mode: 0644]

index 76899dff08fdb2df8309d6adca854154ee5950ab..78c91fc10971d47309b5b54fc817d78532e30703 100644 (file)
@@ -1,3 +1,10 @@
+2009-01-13  Jakub Jelinek  <jakub@redhat.com>
+
+       PR rtl-optimization/38774
+       * combine.c (simplify_set): When undoing cc_use change, don't do
+       PUT_CODE on the newly created comparison, but instead put back the
+       old comparison.
+
 2009-01-13  Joseph Myers  <joseph@codesourcery.com>
 
        * doc/invoke.texi (ARM Options): Update lists of -mcpu and -march
index 82bf9f5e115e815badca7b7d2adc1ad20fe5f4b8..3aca075aae16d934a207f2facbb89560da0b01cd 100644 (file)
@@ -5706,6 +5706,7 @@ simplify_set (rtx x)
        {
          int other_changed_previously = other_changed;
          unsigned HOST_WIDE_INT mask;
+         rtx old_cc_use = *cc_use;
 
          SUBST (*cc_use, gen_rtx_fmt_ee (new_code, GET_MODE (*cc_use),
                                          dest, const0_rtx));
@@ -5728,7 +5729,7 @@ simplify_set (rtx x)
              if ((recog_for_combine (&pat, other_insn, &note) < 0
                   && ! check_asm_operands (pat)))
                {
-                 PUT_CODE (*cc_use, old_code);
+                 *cc_use = old_cc_use;
                  other_changed = 0;
 
                  op0 = simplify_gen_binary (XOR, GET_MODE (op0),
index 18f15ca65abdd26c0e38987ad66c35c772af8e71..ecec2ac1c0cb73e865068156ba3e07f4ada2078e 100644 (file)
@@ -1,5 +1,8 @@
 2009-01-13  Jakub Jelinek  <jakub@redhat.com>
 
+       PR rtl-optimization/38774
+       * gcc.dg/torture/pr38774.c: New test.
+
        PR c++/38795
        * g++.dg/cpp0x/pr38795.C: New test.
 
diff --git a/gcc/testsuite/gcc.dg/torture/pr38774.c b/gcc/testsuite/gcc.dg/torture/pr38774.c
new file mode 100644 (file)
index 0000000..d6d7fcb
--- /dev/null
@@ -0,0 +1,16 @@
+/* PR rtl-optimization/38774 */
+/* { dg-do compile } */
+/* { dg-options "" } */
+/* { dg-options "-march=i686" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
+
+extern int bar (void);
+volatile int g;
+
+int
+foo (void)
+{
+  int a = 1 >= bar ();
+  if ((1 > 9223372036854775807LL - a && 1 - a ? : 1 + a) & 1)
+    return g;
+  return 0;
+}