https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92118
Bug ID: 92118 Summary: warning with [-Wmaybe-uninitialized] in -O1 Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: tangyixuan at mail dot dlut.edu.cn Target Milestone: --- [-Wmaybe-uninitialized] should be independent of optimization levels (-O0/O1/../O3) or may be a spurious Warnings on -O1: $ cat s.c int main() { int i; for(;i<5;i++){ } return 0; } $ gcc-trunk -O1 -Wmaybe-uninitialized s.c s.c: In function ‘main’: s.c:4:13: warning: ‘i’ may be used uninitialized in this function [-Wmaybe-uninitialized] for(;i<5;i++){ ~^~ gcc version 10.0.0 20190913 (experimental) (GCC) target: Ubuntu 4.8.5-4ubuntu8~14.04.2 Since the default value of ‘i’ is 0, there is no warning with -O0/O2/O3.