https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101912
Bug ID: 101912 Summary: -Wmaybe-uninitialized false alarm in tzdb localtime.c Product: gcc Version: 11.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: eggert at cs dot ucla.edu Target Milestone: --- Created attachment 51303 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51303&action=edit -Wuninitialized false alarm This is a simplified version of a problem I found while compiling tzdb's localtime.c with gcc (GCC) 11.2.1 20210728 (Red Hat 11.2.1-1) on x86-64. Compile the attached program w.i with: gcc -Wmaybe-uninitialized -O2 -S w.i The output is: w.i: In function ‘tzloadbody’: w.i:17:27: warning: ‘prevcorr’ may be used uninitialized in this function [-Wmaybe-uninitialized] 16 | : (corr == prevcorr | ~~~~~~~~~~~~~~~~~ 17 | || corr == prevcorr - 1))))) | ^~~~~~~~~~~~~~~~~~~~~~~~ This is a false alarm, since the underlined code is executed only when leapcnt is nonzero, and leapcnt is set to a nonzero value only after prevcorr is initialized.