PR tree-optimization/81303
[official-gcc.git] / gcc / testsuite / gcc.dg / asan / use-after-scope-4.c
blob44dc79535d2ab7921eda8581238b875fc3f0ffe1
1 // { dg-do run }
3 #define FN(NAME) \
4 NAME (void) \
5 { \
6 char *ptr; \
7 char *ptr2; \
8 { \
9 char my_char[9]; \
10 ptr = &my_char[0]; \
11 __builtin_memcpy (&ptr2, &ptr, sizeof (ptr2)); \
12 } \
14 *(ptr2+9) = 'c'; \
17 void
18 __attribute__((no_sanitize(("address"))))
19 __attribute__((no_sanitize(("undefined"))))
20 __attribute__((no_sanitize(("address"))))
21 __attribute__((no_sanitize(("null"))))
22 FN (fn1)
24 void
25 __attribute__((no_sanitize(("all"))))
26 FN (fn2)
28 void
29 __attribute__((no_sanitize_address))
30 FN (fn3)
32 int
33 main (void)
35 fn1 ();
36 fn2 ();
37 fn3 ();
39 return 0;