https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94294
Tamar Christina <tnfchris at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |tnfchris at gcc dot gnu.org --- Comment #5 from Tamar Christina <tnfchris at gcc dot gnu.org> --- (In reply to Marc Glisse from comment #4) > I don't believe there is a "new/delete" issue. I wonder.. , looking at #include <cstdint> #include <cstdlib> #include <vector> struct param { uint32_t k; std::vector<uint8_t> src; std::vector<uint8_t> ref0; }; size_t foo() { param test[] = { {48, {255, 0, 0, 0, 0, 0} }}; return sizeof(test); } I had expected the answer to simply be mov w0, #56 ret since the new and delete can be elided. ...but GCC generates some pretty bad code here... https://godbolt.org/z/EPoYYohPa In this case nothing of the structure is used at all yet we keep all the construction code.