https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105937
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |needs-reduction Target Milestone|--- |12.2 Summary|[12] Regression with |[12/13 Regression] |maybe-uninitialized |maybe-uninitialized with | |std::optional --- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- # ttfRunIndex_64 = PHI <ttfRunIndex_6(52), [/app/example.cpp:207:27] 0(30)> # ttfRunIndex$8_65 = PHI <ttfRunIndex$8_8(52), [/app/example.cpp:207:27] 0(30)> ... <L17>: [/app/example.cpp:213:13] if (ttfRunIndex$8_65 != 0) goto <bb 22>; [33.00%] else goto <bb 48>; [67.00%] ... <bb 22> [local count: 157594832]: [/app/example.cpp:216:62] len_15 = _20 - ttfRunIndex_64; ... # ttfRunIndex_6 = PHI <ttfRunIndex_14(D)(26), ttfRunIndex_64(48), _20(21), ttfRunIndex_64(49)> # ttfRunIndex$8_8 = PHI <0(26), 0(48), [/app/example.cpp:227:29] 1(21), 1(49)> So if anything this is both a missed optimization and the maybe uninitialized predicates is not doing its job correctly.