Require target lra in gcc.dg/pr108095.c
[official-gcc.git] / gcc / testsuite / c-c++-common / asan / pr64820.c
bloba00debf358833ef8de1f2b6ba9d50a2d68c86296
1 /* { dg-do run } */
2 /* { dg-require-effective-target fstack_protector } */
3 /* { dg-options "-fstack-protector-strong" } */
4 /* { dg-set-target-env-var ASAN_OPTIONS "detect_stack_use_after_return=1" } */
5 /* { dg-shouldfail "asan" } */
7 __attribute__((noinline))
8 char *Ident(char *x) {
9 return x;
12 __attribute__((noinline))
13 char *Func1() {
14 char local[1 << 12];
15 return Ident(local);
18 __attribute__((noinline))
19 void Func2(char *x) {
20 *x = 1;
22 int main(int argc, char **argv) {
23 Func2(Func1());
24 return 0;
27 /* { dg-output "AddressSanitizer: stack-use-after-return on address 0x\[0-9a-f\]+\[^\n\r]*(\n|\r\n|\r)" } */
28 /* { dg-output "WRITE of size 1 at .* thread T0.*" } */
29 /* { dg-output " #0.*(Func2)?.*pr64820.(c:21)?.*" } */
30 /* { dg-output "is located in stack of thread T0 at offset.*" } */
31 /* { dg-output "\'local\' \\(line 14\\) <== Memory access at offset 32 is inside this variable" } */