]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR target/67265 ([x86] 'asm' operand has impossible constraints with -fstack-check)
authorEric Botcazou <ebotcazou@adacore.com>
Wed, 11 Nov 2015 16:04:34 +0000 (16:04 +0000)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Wed, 11 Nov 2015 16:04:34 +0000 (16:04 +0000)
PR target/67265
* ira.c (ira_setup_eliminable_regset): Do not necessarily create the
frame pointer for stack checking if non-call exceptions aren't used.
* config/i386/i386.c (ix86_finalize_stack_realign_flags): Likewise.

From-SVN: r230179

gcc/ChangeLog
gcc/config/i386/i386.c
gcc/ira.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/pr67265.c [new file with mode: 0644]

index 94e0cfce764ed383141ed9be3ffb7e1ff3e2defd..245b6a2a48cd422bb5772a00c3af2b572385c906 100644 (file)
@@ -1,3 +1,10 @@
+2015-11-11  Eric Botcazou  <ebotcazou@adacore.com>
+
+       PR target/67265
+       * ira.c (ira_setup_eliminable_regset): Do not necessarily create the
+       frame pointer for stack checking if non-call exceptions aren't used.
+       * config/i386/i386.c (ix86_finalize_stack_realign_flags): Likewise.
+
 2015-11-10  James Greenhalgh  <james.greenhalgh@arm.com>
 
        Partial backport from trunk r228751.
index 1a06d46cebbe04beb7e6d2eb5620ed9d2d6b4a9e..218d7b2a45d35e0f66bc1eff84618c1766396b8b 100644 (file)
@@ -10666,7 +10666,11 @@ ix86_finalize_stack_realign_flags (void)
       && !crtl->accesses_prior_frames
       && !cfun->calls_alloca
       && !crtl->calls_eh_return
-      && !(flag_stack_check && STACK_CHECK_MOVING_SP)
+      /* See ira_setup_eliminable_regset for the rationale.  */
+      && !(STACK_CHECK_MOVING_SP
+          && flag_stack_check
+          && flag_exceptions
+          && cfun->can_throw_non_call_exceptions)
       && !ix86_frame_pointer_required ()
       && get_frame_size () == 0
       && ix86_nsaved_sseregs () == 0
index fb0650e59ecd0d686cc328c71b3ff0470ace4713..544dbf76f872521e049ba5d2c78f5a1e77b4c93b 100644 (file)
--- a/gcc/ira.c
+++ b/gcc/ira.c
@@ -2398,9 +2398,12 @@ ira_setup_eliminable_regset (void)
   frame_pointer_needed
     = (! flag_omit_frame_pointer
        || (cfun->calls_alloca && EXIT_IGNORE_STACK)
-       /* We need the frame pointer to catch stack overflow exceptions
-         if the stack pointer is moving.  */
-       || (flag_stack_check && STACK_CHECK_MOVING_SP)
+       /* We need the frame pointer to catch stack overflow exceptions if
+         the stack pointer is moving (as for the alloca case just above).  */
+       || (STACK_CHECK_MOVING_SP
+          && flag_stack_check
+          && flag_exceptions
+          && cfun->can_throw_non_call_exceptions)
        || crtl->accesses_prior_frames
        || (SUPPORTS_STACK_ALIGNMENT && crtl->stack_realign_needed)
        /* We need a frame pointer for all Cilk Plus functions that use
index 8039aeaeb2d96d056dc624d290153d8fcf6e9e0f..b0e5b0a88cfb3f9fa2335e9af5a2cac345b1103d 100644 (file)
@@ -1,3 +1,7 @@
+2015-11-11  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * gcc.target/i386/pr67265.c: New test.
+
 2015-11-09  Eric Botcazou  <ebotcazou@adacore.com>
 
        * gcc.target/sparc/sparc-ret.c: Rename to...
diff --git a/gcc/testsuite/gcc.target/i386/pr67265.c b/gcc/testsuite/gcc.target/i386/pr67265.c
new file mode 100644 (file)
index 0000000..7827685
--- /dev/null
@@ -0,0 +1,12 @@
+/* PR target/67265 */
+/* Reduced testcase by Johannes Dewender <gnu@JonnyJD.net> */
+
+/* { dg-do compile } */
+/* { dg-options "-O -fstack-check -fPIC" } */
+
+int a, b, c, d, e;
+
+void foo (void)
+{
+  __asm__("" : "+r"(c), "+r"(e), "+r"(d), "+r"(a) : ""(b), "mg"(foo), "mm"(c));
+}