Uros Bizjak <ubiz...@gmail.com> writes:

>>             * config/i386/i386.c (ix86_emit_restore_reg_using_pop):
> Prototype.
>>             (ix86_adjust_stack_and_probe_stack_clash): Use a push/pop
> sequence
>>             to probe at the start of a noreturn function.
>>
>>             * gcc.target/i386/stack-check-12.c: New test
>
> OK.
[...]
>> diff --git a/gcc/testsuite/gcc.target/i386/stack-check-12.c
> b/gcc/testsuite/gcc.target/i386/stack-check-12.c
>> new file mode 100644
>> index 0000000..cb69bb0
>> --- /dev/null
>> +++ b/gcc/testsuite/gcc.target/i386/stack-check-12.c
>> @@ -0,0 +1,19 @@
>> +/* { dg-do compile } */
>> +/* { dg-options "-O2 -fstack-clash-protection -mtune=generic" } */
>> +/* { dg-require-effective-target supports_stack_clash_protection } */
>> +
>> +__attribute__ ((noreturn)) void exit (int);
>> +
>> +__attribute__ ((noreturn)) void
>> +f (void)
>> +{
>> +  asm volatile ("nop" ::: "edi");
>> +  exit (1);
>> +}
>> +
>> +/* { dg-final { scan-assembler-not "or\[ql\]" } } */
>> +/* { dg-final { scan-assembler "pushl  %esi" { target ia32 } } } */
>> +/* { dg-final { scan-assembler "popl   %esi" { target ia32 } } }*/
>> +/* { dg-final { scan-assembler "pushq  %rax" { target { ! ia32 } } } } */
>> +/* { dg-final { scan-assembler "popq   %rax" { target { ! ia32 } } } }*/
>> +
>>

The new test FAILs on 64-bit Solaris/x86 which defaults to
-fno-omit-frame-pointer:

FAIL: gcc.target/i386/stack-check-12.c scan-assembler popq\\t%rax
FAIL: gcc.target/i386/stack-check-12.c scan-assembler pushq\\t%rax

The assembler output boils down to

        .globl  f
        .type   f, @function
f:
        pushq   %rbp
        movq    %rsp, %rbp
        nop
        movl    $1, %edi
        call    exit

        Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

Reply via email to