https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114253
--- Comment #10 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to Andrew Pinski from comment #9) > This looks fixed in GCC 15+. Most likely by r15-6052-g12de1942a0a673 and > r15-9400-ge7bccec33beece . GCC now zeros out the full std::optional<int> in > this case. The missed optimization is still there. Plus there seems like > there is another missed optimization with execeptions on and SRA off but I > am not 100% sure. Yes there is still a missed optimizations at `-O2 -fno-tree-sra -fexceptions`, I will file that seperately.
