https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80331
--- Comment #2 from Marc Glisse <glisse at gcc dot gnu.org> --- If you replace "a" with something longer (size>16 when counting the last '\0'), it does reproduce. I'd say this is a dup of 2 known issues: - the compiled part of libstdc++ prevents optimization (maybe eventually with LTO?), - gcc knows about malloc and free but not about new and delete. I didn't check if those are the only blockers in this case...