aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/i386/stack-check-17.c
blob: b3e41cb3d25560290f31501d3d2119c81cdfce43 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/* { dg-do compile } */
/* { dg-options "-O2 -fstack-clash-protection -mtune=generic -fomit-frame-pointer" } */
/* { dg-require-effective-target supports_stack_clash_protection } */
/* { dg-skip-if "" { *-*-* } { "-fstack-protector*" } { "" } } */



int x0, x1;
void f1 (void);
void f2 (int, int);

__attribute__ ((noreturn))
void
f3 (void)
{ 
  int y0 = x0;
  int y1 = x1;
  f1 ();
  f2 (y0, y1);
  while (1);
}

/* Verify no explicit probes.  */
/* { dg-final { scan-assembler-not "or\[ql\]" } } */

/* We also want to verify we did not use a push/pop sequence
   to probe *sp as the callee register saves are sufficient
   to probe *sp.

   y0/y1 are live across the call and thus must be allocated
   into either a stack slot or callee saved register.  The former
   would be rather dumb.  So assume it does not happen.

   So search for two/four pushes for the callee register saves/argument pushes
   (plus one for the PIC register if needed on ia32) and no pops (since the
   function has no reachable epilogue).  */
/* { dg-final { scan-assembler-times "push\[ql\]" 2 { target { ! ia32 } } } }  */
/* { dg-final { scan-assembler-times "push\[ql\]" 4 { target { ia32 && nonpic } } } }  */
/* { dg-final { scan-assembler-times "push\[ql\]" 5 { target { ia32 && { ! nonpic } } } } }  */
/* { dg-final { scan-assembler-not "pop" } } */