Debian Codegraph @

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

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