Daily bump.
[official-gcc.git] / gcc / testsuite / gcc.target / arm / stack-protector-3.c
blob2f710529b8ff178b514d4d1f5fdcfa1f9dad5036
1 /* { dg-do run } */
2 /* { dg-require-effective-target fstack_protector } */
3 /* { dg-options "-fstack-protector-all -O2" } */
5 extern volatile long *stack_chk_guard_ptr;
7 void __attribute__ ((noipa))
8 f (void)
10 volatile int x;
11 /* Munging the contents of __stack_chk_guard should trigger a
12 stack-smashing failure for this function. */
13 *stack_chk_guard_ptr += 1;
16 asm (
17 " .data\n"
18 " .align 3\n"
19 " .globl stack_chk_guard_ptr\n"
20 "stack_chk_guard_ptr:\n"
21 " .word __stack_chk_guard\n"
22 " .weak __stack_chk_guard\n"
23 "__stack_chk_guard:\n"
24 " .word 0xdead4321\n"
25 " .text\n"
26 " .type __stack_chk_fail, %function\n"
27 "__stack_chk_fail:\n"
28 " movs r0, #0\n"
29 " bl exit\n"
30 " .size __stack_chk_fail, .-__stack_chk_fail"
33 int
34 main (void)
36 f ();
37 __builtin_abort ();