Fortran: Fix PR 47485.
[gcc.git] / gcc / testsuite / g++.dg / asan / function-argument-1.C
blobf421ad68b5db2613176745e4444b3c1fc4ffd10c
1 // { dg-do run }
2 // { dg-shouldfail "asan" }
3 // { dg-options "-fsanitize=address -fno-sanitize-address-use-after-scope" }
5 struct A
7   int a[5];
8 };
10 static __attribute__ ((noinline)) int
11 goo (A *a)
13   int *ptr = &a->a[0];
14   return *(volatile int *) (ptr - 1);
17 __attribute__ ((noinline)) int
18 foo (A arg)
20   return goo (&arg);
23 int
24 main ()
26   return foo (A ());
29 // { dg-output "ERROR: AddressSanitizer: stack-buffer-underflow on address.*(\n|\r\n|\r)" }
30 // { dg-output "READ of size . at.*" }
31 // { dg-output ".*'arg' \\(line 18\\) <== Memory access at offset \[0-9\]* underflows this variable.*" }