public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/111577] New: -Os gives significantly bigger code than -O0
@ 2023-09-25  0:33 socketpair at gmail dot com
  2023-09-25  0:50 ` [Bug middle-end/111577] " pinskia at gcc dot gnu.org
  2023-09-25  0:53 ` pinskia at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: socketpair at gmail dot com @ 2023-09-25  0:33 UTC (permalink / raw)
  To: gcc-bugs

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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-09-25  0:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-25  0:33 [Bug c++/111577] New: -Os gives significantly bigger code than -O0 socketpair at gmail dot com
2023-09-25  0:50 ` [Bug middle-end/111577] " pinskia at gcc dot gnu.org
2023-09-25  0:53 ` pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).