https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67196
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed|2015-08-12 00:00:00 |2021-3-31 Known to fail| |10.2.0, 11.0, 5.5.0, 6.4.0, | |7.2.0, 8.3.0, 9.1.0 CC| |msebor at gcc dot gnu.org Summary|Another false positive from |[9/10/11 Regression] |-Wmaybe-uninitialized |loop-induced false positive | |from -Wmaybe-uninitialized Keywords| |diagnostic --- Comment #3 from Martin Sebor <msebor at gcc dot gnu.org> --- Reconfirmed with GCC 11 as a regression introduced in r185913 (4.8.0 20120328). Nothing in the IL jumps out at me that could be used by the predicate analysis to rule out the false positive: the use in the return statement in bb 8 looks unconditional. pr67196.c: In function ‘test’: pr67196.c:7:7: warning: ‘first_caption_idx’ may be used uninitialized in this function [-Wmaybe-uninitialized] 7 | int first_caption_idx; | ^~~~~~~~~~~~~~~~~ int test (int n) { int i; int first_caption_idx; int first_caption; int num_captions_in_row; int _1; _Bool _2; _Bool _3; _Bool _4; int _12; <bb 2> [local count: 118111600]: if (n_16(D) > 0) goto <bb 9>; [89.00%] else goto <bb 11>; [11.00%] <bb 11> [local count: 12992276]: goto <bb 8>; [100.00%] <bb 9> [local count: 105119324]: <bb 3> [local count: 955630225]: # num_captions_in_row_25 = PHI <num_captions_in_row_5(10), 0(9)> # first_caption_27 = PHI <first_caption_7(10), 0(9)> # first_caption_idx_29 = PHI <first_caption_idx_9(10), first_caption_idx_14(D)(9)> <<< (3) first_caption_idx_14(D) is uninitialized # i_31 = PHI <i_19(10), 0(9)> _1 = some_test (i_31); if (_1 != 0) goto <bb 4>; [50.00%] else goto <bb 12>; [50.00%] <bb 12> [local count: 477815113]: goto <bb 5>; [100.00%] <bb 4> [local count: 477815112]: num_captions_in_row_18 = num_captions_in_row_25 + 1; <bb 5> [local count: 955630225]: # num_captions_in_row_5 = PHI <num_captions_in_row_25(12), num_captions_in_row_18(4)> # first_caption_7 = PHI <first_caption_27(12), 1(4)> # first_caption_idx_9 = PHI <first_caption_idx_29(12), i_31(4)> <<< (2) i_19 = i_31 + 1; if (n_16(D) != i_19) goto <bb 10>; [89.00%] else goto <bb 6>; [11.00%] <bb 10> [local count: 850510901]: goto <bb 3>; [100.00%] <bb 6> [local count: 105119324]: _2 = first_caption_7 != 0; _3 = num_captions_in_row_5 == 1; _4 = _2 & _3; if (_4 != 0) goto <bb 13>; [38.20%] else goto <bb 7>; [61.80%] <bb 13> [local count: 40157944]: goto <bb 8>; [100.00%] <bb 7> [local count: 64961380]: <bb 8> [local count: 118111600]: # _12 = PHI <first_caption_idx_9(13), 0(7), 0(11)> <<< (1) return _12; <<< use }