PR target/82002 Part 1: Correct ICE caused by wrong calculation
authorDaniel Santos <daniel.santos@pobox.com>
Tue, 31 Oct 2017 21:48:55 +0000 (21:48 +0000)
committerDaniel Santos <dansan@gcc.gnu.org>
Tue, 31 Oct 2017 21:48:55 +0000 (21:48 +0000)
gcc:
config/i386/i386.c (ix86_expand_epilogue): Correct stack
calculation.

gcc/testsuite:
gcc.target/i386/pr82002-1.c: New test.
gcc.target/i386/pr82002-2a.c: New xfail test.
gcc.target/i386/pr82002-2b.c: New xfail test.

From-SVN: r254284

gcc/ChangeLog
gcc/config/i386/i386.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/pr82002-1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/pr82002-2a.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/pr82002-2b.c [new file with mode: 0644]

index 689b5ab37114c2ac21214dce00b8b98578ce5373..62f81b70b9b8d7f1a228902e9b53a399a16eb056 100644 (file)
@@ -1,3 +1,8 @@
+2017-10-31  Daniel Santos  <daniel.santos@pobox.com>
+
+       config/i386/i386.c (ix86_expand_epilogue): Correct stack
+       calculation.
+
 2017-10-31  Martin Jambor  <mjambor@suse.cz>
 
        PR c++/81702
index 382635f4fc750fee07ca3bbf5f1c7c77a1c94307..56c59e991e33baa3b4f073c655557d244ae58eaa 100644 (file)
@@ -13812,7 +13812,7 @@ ix86_expand_epilogue (int style)
         the stack pointer, if we will restore SSE regs via sp.  */
       if (TARGET_64BIT
          && m->fs.sp_offset > 0x7fffffff
-         && sp_valid_at (frame.stack_realign_offset)
+         && sp_valid_at (frame.stack_realign_offset + 1)
          && (frame.nsseregs + frame.nregs) != 0)
        {
          pro_epilogue_adjust_stack (stack_pointer_rtx, stack_pointer_rtx,
index 82fd2aa74953fffea396c4bbe2d0024b600f2bbb..68c4b2651a52570219af0e24b74db9ae51759c4a 100644 (file)
@@ -1,3 +1,9 @@
+2017-10-31  Daniel Santos  <daniel.santos@pobox.com>
+
+       gcc.target/i386/pr82002-1.c: New test.
+       gcc.target/i386/pr82002-2a.c: New xfail test.
+       gcc.target/i386/pr82002-2b.c: New xfail test.
+
 2017-10-31  Martin Jambor  <mjambor@suse.cz>
 
        PR c++/81702
diff --git a/gcc/testsuite/gcc.target/i386/pr82002-1.c b/gcc/testsuite/gcc.target/i386/pr82002-1.c
new file mode 100644 (file)
index 0000000..86678a0
--- /dev/null
@@ -0,0 +1,12 @@
+/* { dg-do compile { target lp64 } } */
+/* { dg-options "-Ofast -mstackrealign -mabi=ms" } */
+
+void a (char *);
+void
+b ()
+{
+  char c[10000000000];
+  c[1099511627776] = 'b';
+  a (c);
+  a (c);
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr82002-2a.c b/gcc/testsuite/gcc.target/i386/pr82002-2a.c
new file mode 100644 (file)
index 0000000..bc85080
--- /dev/null
@@ -0,0 +1,14 @@
+/* { dg-do compile { target lp64 } } */
+/* { dg-options "-Ofast -mstackrealign -mabi=ms" } */
+/* { dg-xfail-if "" { *-*-* }  } */
+/* { dg-xfail-run-if "" { *-*-* }  } */
+
+void __attribute__((sysv_abi)) a (char *);
+void
+b ()
+{
+  char c[10000000000];
+  c[1099511627776] = 'b';
+  a (c);
+  a (c);
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr82002-2b.c b/gcc/testsuite/gcc.target/i386/pr82002-2b.c
new file mode 100644 (file)
index 0000000..10e44cd
--- /dev/null
@@ -0,0 +1,14 @@
+/* { dg-do compile { target lp64 } } */
+/* { dg-options "-Ofast -mstackrealign -mabi=ms -mcall-ms2sysv-xlogues" } */
+/* { dg-xfail-if "" { *-*-* }  } */
+/* { dg-xfail-run-if "" { *-*-* }  } */
+
+void __attribute__((sysv_abi)) a (char *);
+void
+b ()
+{
+  char c[10000000000];
+  c[1099511627776] = 'b';
+  a (c);
+  a (c);
+}