From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6B12F3858C66; Mon, 25 Sep 2023 00:33:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6B12F3858C66 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1695602017; bh=Kn8kI0UxMA2Xd2cYWlySXviYH8UsnHksONNCq5PEkgE=; h=From:To:Subject:Date:From; b=O+Scr83cMI66asrKmnR2z6bACpOoNyB+HA9ero+IeiL7qkPR9VKy+soaMA9Zj2cHx DZ7E/Ytp8/qVgNUA0jQ1jpvlqNAyceuh8Zww54KPM1gwEcq4vkQudLaMBt1Ar3bH0U oEQm6rmwNiUUwCE4961hRWsSIFVqId3nb5Z8ApFY= From: "socketpair at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/111577] New: -Os gives significantly bigger code than -O0 Date: Mon, 25 Sep 2023 00:33:36 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: socketpair at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D111577 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 using namespace std; int main(int argc, char* argv[]) { if (argv[0] =3D=3D nullptr || argv[1] =3D=3D nullptr) return 0; string zxc(argv[0]); string qwe(argv[1]); string asd(argv[2]); zxc =3D qwe + asd; return zxc.size(); } ``` -Os -std=3Dc++2b -march=3Dskylake -m64 (615 bytes) compare size with the smae, but with options: -O0 -std=3Dc++2b -march=3Dskylake -m64 (409 bytes) -O0 - is much LESS (!) in bytes. I think it's a bug.=