1 /* PR tree-optimization/59970 - Bogus -Wmaybe-uninitialized at low optimization
4 { dg-options "-Wall" } */
6 #pragma GCC push_options
7 #pragma GCC optimize ("1")
9 __attribute__ ((noipa
)) int
10 d_demangle_callback_O1 (const char *mangled
)
12 enum { DCT_TYPE
, DCT_GLOBAL_DTORS
} type
;
15 /* Fails for -Og and -O1. */
17 type
= DCT_GLOBAL_DTORS
;
21 /* If both cases assign the same value, all is fine. */
27 case DCT_GLOBAL_DTORS
:
31 /* If this is added, all is fine. */
34 __builtin_unreachable ();
38 return dc
; // { dg-bogus "uninitialized" }
41 #pragma GCC pop_options
44 #pragma GCC optimize ("Og")
46 __attribute__ ((noipa
)) int
47 d_demangle_callback_Og (const char *mangled
)
49 enum { DCT_TYPE
, DCT_GLOBAL_DTORS
} type
;
53 /* Removing either the function call or the array dereference, it'll be like
55 extern int cmp (void);
56 if (cmp () && mangled
[0])
57 type
= DCT_GLOBAL_DTORS
;
61 /* If both cases assign the same value, all is fine. */
67 case DCT_GLOBAL_DTORS
:
71 /* If this is added, all is fine. */
74 __builtin_unreachable ();
78 return dc
; // { dg-bogus "uninitialized" }