Debian Codegraph @

gcc/testsuite/gcc.dg/asan/use-after-scope-4.c

raw
1 // { dg-do run }
2 /* { dg-options "-fno-stack-protector" } */
3
4 #define FN(NAME) \
5 NAME (void) \
6 { \
7 char *ptr; \
8 char *ptr2; \
9 { \
10 char my_char[9]; \
11 ptr = &my_char[0]; \
12 __builtin_memcpy (&ptr2, &ptr, sizeof (ptr2)); \
13 } \
14 \
15 *(ptr2+9) = 'c'; \
16 }
17
18 void
19 __attribute__((no_sanitize(("address"))))
20 __attribute__((no_sanitize(("undefined"))))
21 __attribute__((no_sanitize(("address"))))
22 __attribute__((no_sanitize(("null"))))
23 FN (fn1)
24
25 void
26 __attribute__((no_sanitize(("all"))))
27 FN (fn2)
28
29 void
30 __attribute__((no_sanitize_address))
31 FN (fn3)
32
33 int
34 main (void)
35 {
36 fn1 ();
37 fn2 ();
38 fn3 ();
39
40 return 0;
41 }