This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] Fix PR target/67265


On 11/11/2015 12:38 PM, Eric Botcazou wrote:
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++.

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

This piece of code along doesn't tell me exactly why the frame pointer is needed. I was looking for an explicit use, but I now guess that if you have multiple adjusts of the frame pointer you can't easily undo them in the error case (the function behaves as-if using alloca). Is that it? And without exceptions I assume you just get a call to abort so it doesn't matter? If I understood all that right, then this is ok.

In i386.c I see a code block with a similar condition,

  /* If the only reason for frame_pointer_needed is that we conservatively
     assumed stack realignment might be needed, but in the end nothing that
needed the stack alignment had been spilled, clear frame_pointer_needed
     and say we don't need stack realignment.  */

and the condition has

      && !(flag_stack_check && STACK_CHECK_MOVING_SP)

Should that be changed too?


Bernd


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]