https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111577
Bug ID: 111577 Summary: -Os gives significantly bigger code than -O0 Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: socketpair at gmail dot com Target Milestone: --- Yes, I saw #35806, #41175 and others. See https://godbolt.org/z/Pnh89Y3Yb ``` #include <string> using namespace std; int main(int argc, char* argv[]) { if (argv[0] == nullptr || argv[1] == nullptr) return 0; string zxc(argv[0]); string qwe(argv[1]); string asd(argv[2]); zxc = qwe + asd; return zxc.size(); } ``` -Os -std=c++2b -march=skylake -m64 (615 bytes) compare size with the smae, but with options: -O0 -std=c++2b -march=skylake -m64 (409 bytes) -O0 - is much LESS (!) in bytes. I think it's a bug.