summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'sys-devel/gcc/files/3.2.2/gcc32-pr8213.patch')
-rw-r--r--sys-devel/gcc/files/3.2.2/gcc32-pr8213.patch69
1 files changed, 69 insertions, 0 deletions
diff --git a/sys-devel/gcc/files/3.2.2/gcc32-pr8213.patch b/sys-devel/gcc/files/3.2.2/gcc32-pr8213.patch
new file mode 100644
index 0000000..762d198
--- /dev/null
+++ b/sys-devel/gcc/files/3.2.2/gcc32-pr8213.patch
@@ -0,0 +1,69 @@
+2002-10-30 Jan Hubicka <jh@suse.cz>
+
+ PR target/8213
+ * config/i386/i386.c (ix86_expand_int_movcc): Fix RTL sharing problem.
+
+2002-11-04 Gwenole Beauchesne <gbeauchesne@mandrakesoft.com>
+
+ * testsuite/gcc.c-torture/execute/20021104.c: New test.
+
+--- gcc-3.2/gcc/config/i386/i386.c.pr8213 2002-11-04 12:56:37.000000000 -0500
++++ gcc-3.2/gcc/config/i386/i386.c 2002-11-04 13:21:22.000000000 -0500
+@@ -8274,11 +8274,11 @@ ix86_expand_int_movcc (operands)
+ /* On x86_64 the lea instruction operates on Pmode, so we need to get arithmetics
+ done in proper mode to match. */
+ if (diff == 1)
+- tmp = out;
++ tmp = copy_rtx (out);
+ else
+ {
+ rtx out1;
+- out1 = out;
++ out1 = copy_rtx (out);
+ tmp = gen_rtx_MULT (mode, out1, GEN_INT (diff & ~1));
+ nops++;
+ if (diff & 1)
+@@ -8302,12 +8302,12 @@ ix86_expand_int_movcc (operands)
+ clob = gen_rtx_REG (CCmode, FLAGS_REG);
+ clob = gen_rtx_CLOBBER (VOIDmode, clob);
+
+- tmp = gen_rtx_SET (VOIDmode, out, tmp);
++ tmp = gen_rtx_SET (VOIDmode, copy_rtx (out), tmp);
+ tmp = gen_rtx_PARALLEL (VOIDmode, gen_rtvec (2, copy_rtx (tmp), clob));
+ emit_insn (tmp);
+ }
+ else
+- emit_insn (gen_rtx_SET (VOIDmode, out, tmp));
++ emit_insn (gen_rtx_SET (VOIDmode, copy_rtx (out), tmp));
+ }
+ if (out != operands[0])
+ emit_move_insn (operands[0], copy_rtx (out));
+--- gcc-3.2/gcc/testsuite/gcc.c-torture/execute/20021104.c.pr8213 2002-11-04 13:22:33.000000000 -0500
++++ gcc-3.2/gcc/testsuite/gcc.c-torture/execute/20021104.c 2002-11-04 13:24:12.000000000 -0500
+@@ -0,0 +1,26 @@
++/* PR target/8213
++ This testcase, distilled from GNU gmp 4.1, was miscompiled on x86-64
++ because of RTL sharing problems. */
++
++int f(long x, long y)
++{
++ if ((x < 0) == (y < 0))
++ {
++ if (x == 0)
++ return -(y != 0);
++ if (y == 0)
++ return x != 0;
++ }
++ else
++ {
++ return x >= 0 ? 1 : -1;
++ }
++}
++
++int main(void)
++{
++ if (f(-1, 1) != -1)
++ abort();
++
++ return 0;
++}