Debian Codegraph @

gcc/testsuite/g++.dg/asan/function-argument-2.C

raw
1 // { dg-do run }
2 // { dg-shouldfail "asan" }
3
4 static __attribute__ ((noinline)) int
5 goo (int *a)
6 {
7 return *(volatile int *)a;
8 }
9
10 __attribute__ ((noinline)) int
11 foo (char arg)
12 {
13 return goo ((int *)&arg);
14 }
15
16 int
17 main ()
18 {
19 return foo (12);
20 }
21
22 // { dg-output "ERROR: AddressSanitizer: stack-buffer-overflow on address.*(\n|\r\n|\r)" }
23 // { dg-output "READ of size . at.*" }
24 // { dg-output ".*'arg' \\(line 11\\) <== Memory access at offset \[0-9\]* partially overflows this variable.*" }