]>
Commit | Line | Data |
---|---|---|
2efe245b MS |
1 | /* PR tree-optimization/93100 - gcc -fsanitize=address inhibits -Wuninitialized |
2 | { dg-do compile } | |
d64584d2 | 3 | { dg-options "-Wall -fsanitize=address" } |
6e6bf4cd | 4 | { dg-skip-if "no address sanitizer" { no_fsanitize_address } } */ |
2efe245b MS |
5 | |
6 | struct A | |
7 | { | |
8 | _Bool b; | |
9 | int i; | |
10 | }; | |
11 | ||
12 | void warn_A_b_O0 (void) | |
13 | { | |
14 | struct A a; | |
15 | ||
16 | if (a.b) // { dg-warning "\\\[-Wuninitialized" } | |
17 | { | |
18 | (void)&a; | |
19 | } | |
20 | } | |
21 | ||
22 | void warn_A_i_O0 (void) | |
23 | { | |
24 | struct A a; | |
25 | ||
26 | if (a.i) // { dg-warning "\\\[-Wuninitialized" } | |
27 | { | |
28 | (void)&a; | |
29 | } | |
30 | } | |
31 | ||
32 | #pragma GCC optimize ("1") | |
33 | ||
34 | void warn_A_b_O1 (void) | |
35 | { | |
36 | struct A a; | |
37 | ||
38 | if (a.b) // { dg-warning "\\\[-Wuninitialized" } | |
39 | { | |
40 | (void)&a; | |
41 | } | |
42 | } | |
43 | ||
44 | void warn_A_i_O1 (void) | |
45 | { | |
46 | struct A a; | |
47 | ||
48 | if (a.i) // { dg-warning "\\\[-Wuninitialized" } | |
49 | { | |
50 | (void)&a; | |
51 | } | |
52 | } | |
53 | ||
54 | ||
55 | #pragma GCC optimize ("2") | |
56 | ||
57 | void warn_A_b_O2 (void) | |
58 | { | |
59 | struct A a; | |
60 | ||
61 | if (a.b) // { dg-warning "\\\[-Wuninitialized" } | |
62 | { | |
63 | (void)&a; | |
64 | } | |
65 | } | |
66 | ||
67 | void warn_A_i_O2 (void) | |
68 | { | |
69 | struct A a; | |
70 | ||
71 | if (a.i) // { dg-warning "\\\[-Wuninitialized" } | |
72 | { | |
73 | (void)&a; | |
74 | } | |
75 | } |