| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O2 -fstack-protector" } */ |
| 3 |
/* { dg-require-effective-target fstack_protector } */ |
| 4 |
/* There should be 2 references to __stack_chk_guard in every function. */ |
| 5 |
/* { dg-final { scan-assembler-times "__stack_chk_guard" 4 } } */ |
| 6 |
|
| 7 |
#include <stdlib.h> |
| 8 |
#include <string.h> |
| 9 |
void doTest1(void) { |
| 10 |
volatile char foo[10]; |
| 11 |
memset((void *)foo, 1, 100); |
| 12 |
asm volatile("# %0" : : "g"(foo)); |
| 13 |
} |
| 14 |
void doTest2(void) { |
| 15 |
volatile char foo[10]; |
| 16 |
memset((void *)foo, 1, 100); |
| 17 |
asm volatile("# %0" : : "g"(foo)); |
| 18 |
} |