public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [patch] Fix PR target/67265
@ 2015-11-11 11:40 Eric Botcazou
  2015-11-11 12:02 ` Bernd Schmidt
  0 siblings, 1 reply; 5+ messages in thread
From: Eric Botcazou @ 2015-11-11 11:40 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 930 bytes --]

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  <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.


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

-- 
Eric Botcazou

[-- Attachment #2: pr67265.diff --]
[-- Type: text/x-patch, Size: 719 bytes --]

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

[-- Attachment #3: pr67265.c --]
[-- Type: text/x-csrc, Size: 276 bytes --]

/* 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));
}

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-11-12 11:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-11 11:40 [patch] Fix PR target/67265 Eric Botcazou
2015-11-11 12:02 ` Bernd Schmidt
2015-11-11 12:33   ` Eric Botcazou
2015-11-11 12:36     ` Bernd Schmidt
2015-11-12 11:55       ` Eric Botcazou

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).