https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122986
Bug ID: 122986
Summary: -Wmaybe-uninitialized warnings occur with -O2, but not
O1 or O3
Product: gcc
Version: 15.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: wickedsmoke at users dot sourceforge.net
Target Milestone: ---
Created attachment 62982
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=62982&action=edit
-Wmaybe-uninitialized example
The attached C++ file reports -Wmaybe-uninitialized warnings with -O2, but not
O0, O1 or O3.
Compile with:
g++ -c -Wall imagemgr.cpp -O2
The values are initialized, so this seems like an optimization bug.
The warnings occur with Fedora's GCC 14.3.1 and 15.2.1.