> Ok if it passes testing.

Thanks, it did so I installed the fix yesterday but further testing then 
revealed an oversight: the following assertion in ix86_adjust_stack_and_probe

  gcc_assert (cfun->machine->fs.cfa_reg != stack_pointer_rtx);

will now evidently trigger (simple testcase attached).

I can sched some light on it here since I wrote the code: the initial version 
of ix86_adjust_stack_and_probe didn't bother generating CFI because it only 
manipulates the stack pointer and the CFA register was guaranteed to be the 
frame pointer until yesterday, so I put the assertion to check this guarantee.
Then Richard H. enhanced the CFI machinery to always track stack adjustments 
(IIRC this was a prerequisite for your implementation of shrink-wrapping) so I 
added code to generate CFI:

  /* Even if the stack pointer isn't the CFA register, we need to correctly
     describe the adjustments made to it, in particular differentiate the
     frame-related ones from the frame-unrelated ones.  */
  if (size > 0)

To sum up, I think that the assertion is obsolete and can be removed without 
further ado; once done, the compiler generates correct CFI for the testcase.
So I installed the following one-liner as obvious after testing on x86-64.


2015-11-12  Eric Botcazou  <ebotca...@adacore.com>

        PR target/67265
        * config/i386/i386.c (ix86_adjust_stack_and_probe): Remove obsolete
        assertion on the CFA register.


2015-11-12  Eric Botcazou  <ebotca...@adacore.com>

        * gcc.target/i386/pr67265-2.c: New test.

-- 
Eric Botcazou
Index: config/i386/i386.c
===================================================================
--- config/i386/i386.c	(revision 230204)
+++ config/i386/i386.c	(working copy)
@@ -12245,8 +12245,6 @@ ix86_adjust_stack_and_probe (const HOST_
       release_scratch_register_on_entry (&sr);
     }
 
-  gcc_assert (cfun->machine->fs.cfa_reg != stack_pointer_rtx);
-
   /* Even if the stack pointer isn't the CFA register, we need to correctly
      describe the adjustments made to it, in particular differentiate the
      frame-related ones from the frame-unrelated ones.  */
/* { dg-do compile } */
/* { dg-options "-O -fstack-check" } */

void foo (int n)
{
  volatile char arr[64 * 1024];

  arr[n] = 1;
}

Reply via email to