Hi,

this is an ICE on an asm statement requiring a lot of registers, when compiled 
in 32-bit mode on x86/Linux with -O -fstack-check -fPIC:

pr67265.c:10:3: error: 'asm' operand has impossible constraints

The issue is that, since stack checking defines STACK_CHECK_MOVING_SP on this 
platform, the frame pointer is necessary in order to be able to propagate 
exceptions raised on stack overflow.  But this is required only in Ada so we 
can certainly avoid doing it in C or C++.

Tested on x86_64-suse-linux, OK for all active branches ? (that's a regression 
wrt the old stack checking implementation)


2015-11-11  Eric Botcazou  <ebotca...@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.


2015-11-11  Eric Botcazou  <ebotca...@adacore.com>
        
        * gcc.target/i386/pr67265.c: New test.

-- 
Eric Botcazou
Index: ira.c
===================================================================
--- ira.c	(revision 230146)
+++ ira.c	(working copy)
@@ -2261,7 +2261,10 @@ ira_setup_eliminable_regset (void)
        || (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)
+       || (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
/* PR target/67265 */
/* Reduced testcase by Johannes Dewender <g...@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));
}

Reply via email to