https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118634
Bug ID: 118634 Summary: [15 Regression] missed optimization leading to maybe-uninitiallized warning Product: gcc Version: 15.0 Status: UNCONFIRMED Keywords: false-positive, missed-optimization Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: phosit at autistici dot org Target Milestone: --- Created attachment 60255 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=60255&action=edit reduced testcase When compiling the attached source with `gcc-15 -Wmaybe-uninitialized -O2` there is a warning: maybe-uninitialized.cpp: In function 'int main()': maybe-uninitialized.cpp:43:31: warning: '((<unnamed>::optional*)<unknown>)[2].{anonymous}::optional::value' may be used uninitialized [-Wmaybe-uninitialized] 43 | if (find(c, counter)->value != counter) { | ~~~~~~~~~~~~~~~~~~^~~~~ When compiling with gcc 14 or with -O3 there is no warning and the asm is a simple `ret`.