111
|
1 // { dg-do run }
|
|
2 // { dg-shouldfail "asan" }
|
|
3
|
|
4 #include <stdio.h>
|
|
5
|
|
6 struct Test
|
|
7 {
|
|
8 Test ()
|
|
9 {
|
|
10 my_value = 0;
|
|
11 }
|
|
12
|
|
13 ~Test ()
|
|
14 {
|
|
15 fprintf (stderr, "Value: %d\n", *my_value);
|
|
16 }
|
|
17
|
|
18 void init (int *v)
|
|
19 {
|
|
20 my_value = v;
|
|
21 }
|
|
22
|
|
23 int *my_value;
|
|
24 };
|
|
25
|
|
26 int main(int argc, char **argv)
|
|
27 {
|
|
28 Test t;
|
|
29
|
|
30 {
|
|
31 int x = argc;
|
|
32 t.init(&x);
|
|
33 }
|
|
34
|
|
35 return 0;
|
|
36 }
|
|
37
|
|
38 // { dg-output "ERROR: AddressSanitizer: stack-use-after-scope on address.*(\n|\r\n|\r)" }
|
|
39 // { dg-output "READ of size 4 at.*" }
|
131
|
40 // { dg-output ".*'x' \\(line 31\\) <== Memory access at offset \[0-9\]* is inside this variable.*" }
|