aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@gcc.gnu.org>2006-09-30 13:31:29 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2006-09-30 13:31:29 +0000
commit2d7224235688114edd75330c61527621c3731ee8 (patch)
treed07cacf4059837374203a5fe4bbf8717106d9a66
parent10d2ebc511a7ded41cb31255b3e4c306e44e5f4e (diff)
downloadgcc-2d7224235688114edd75330c61527621c3731ee8.zip
gcc-2d7224235688114edd75330c61527621c3731ee8.tar.gz
gcc-2d7224235688114edd75330c61527621c3731ee8.tar.bz2
re PR rtl-optimization/28096 (fdlibm/strtod.c miscompiled at -O2)
PR rtl-optimization/28096 * ifcvt.c (check_cond_move_block): Return FALSE if the source of an assignment has already been used as a destination earlier in the block. From-SVN: r117331
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/ifcvt.c10
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/20060930-1.c42
4 files changed, 63 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 3f96481..7a0e026 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,4 +1,10 @@
-2006-09-28 Eric Botcazou <ebotcazou@adacore.com>
+2006-09-30 Eric Botcazou <ebotcazou@libertysurf.fr>
+
+ PR rtl-optimization/28096
+ * ifcvt.c (check_cond_move_block): Return FALSE if the source of an
+ assignment has already been used as a destination earlier in the block.
+
+2006-09-29 Eric Botcazou <ebotcazou@adacore.com>
* builtins.c (expand_builtin_setjmp): Delete.
(expand_builtin) <BUILT_IN_SETJMP>: Mark as unreachable.
diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c
index 41da0b3..8609823 100644
--- a/gcc/ifcvt.c
+++ b/gcc/ifcvt.c
@@ -2424,7 +2424,7 @@ check_cond_move_block (basic_block bb, rtx *vals, rtx cond)
src = SET_SRC (set);
if (!REG_P (dest)
|| (SMALL_REGISTER_CLASSES && HARD_REGISTER_P (dest)))
- return false;
+ return FALSE;
if (!CONSTANT_P (src) && !register_operand (src, VOIDmode))
return FALSE;
@@ -2435,6 +2435,14 @@ check_cond_move_block (basic_block bb, rtx *vals, rtx cond)
if (may_trap_p (src) || may_trap_p (dest))
return FALSE;
+ /* Don't try to handle this if the source register was
+ modified earlier in the block. */
+ if ((REG_P (src)
+ && vals[REGNO (src)] != NULL)
+ || (GET_CODE (src) == SUBREG && REG_P (SUBREG_REG (src))
+ && vals[REGNO (SUBREG_REG (src))] != NULL))
+ return FALSE;
+
/* Don't try to handle this if the destination register was
modified earlier in the block. */
if (vals[REGNO (dest)] != NULL)
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 7d29c05..c5c774a 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2006-09-30 Eric Botcazou <ebotcazou@libertysurf.fr>
+
+ * gcc.c-torture/execute/20060930-1.c: New test.
+
2006-09-29 Francois-Xavier Coudert <coudert@clipper.ens.fr>
PR fortran/18791
@@ -15,7 +19,7 @@
* gfortran.dg/nearest_1.f90: Add -ffloat-store to defeat extra
precision on some archs.
-2006-09-28 Eric Botcazou <ebotcazou@adacore.com>
+2006-09-29 Eric Botcazou <ebotcazou@adacore.com>
* gcc.dg/non-local-goto-1.c: New test.
* gcc.dg/non-local-goto-2.c: Likewise.
diff --git a/gcc/testsuite/gcc.c-torture/execute/20060930-1.c b/gcc/testsuite/gcc.c-torture/execute/20060930-1.c
new file mode 100644
index 0000000..f12ee55
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/20060930-1.c
@@ -0,0 +1,42 @@
+/* PR rtl-optimization/28096 */
+/* Origin: Jan Stein <jan@gatespacetelematics.com> */
+
+extern void abort (void);
+
+int bar (int, int) __attribute__((noinline));
+int bar (int a, int b)
+{
+ if (b != 1)
+ abort ();
+}
+
+void foo(int, int) __attribute__((noinline));
+void foo (int e, int n)
+{
+ int i, bb2, bb5;
+
+ if (e > 0)
+ e = -e;
+
+ for (i = 0; i < n; i++)
+ {
+ if (e >= 0)
+ {
+ bb2 = 0;
+ bb5 = 0;
+ }
+ else
+ {
+ bb5 = -e;
+ bb2 = bb5;
+ }
+
+ bar (bb5, bb2);
+ }
+}
+
+int main(void)
+{
+ foo (1, 1);
+ return 0;
+}