public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/98364] New: C++20 module binary bloat
@ 2020-12-17 23:43 unlvsur at live dot com
  2020-12-18 13:40 ` [Bug c++/98364] C++20 module global constructor emission nathan at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: unlvsur at live dot com @ 2020-12-17 23:43 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98364

            Bug ID: 98364
           Summary: C++20 module binary bloat
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: unlvsur at live dot com
  Target Milestone: ---

the module will generate _ZGIW5helloEv which is dead code. There is no way to
remove them.

naive binary without module:

#include<cstdio>

int main()
{
        puts("Hello World\n");
}

Disassembly of section .text:

0000000000401040 <main>:
  401040:       48 83 ec 08             sub    $0x8,%rsp
  401044:       bf 04 20 40 00          mov    $0x402004,%edi
  401049:       e8 e2 ff ff ff          callq  401030 <puts@plt>
  40104e:       31 c0                   xor    %eax,%eax
  401050:       48 83 c4 08             add    $0x8,%rsp
  401054:       c3                      retq   
  401055:       66 2e 0f 1f 84 00 00    nopw   %cs:0x0(%rax,%rax,1)
  40105c:       00 00 00 
  40105f:       90                      nop

0000000000401060 <set_fast_math>:
  401060:       f3 0f 1e fa             endbr64 
  401064:       0f ae 5c 24 fc          stmxcsr -0x4(%rsp)
  401069:       81 4c 24 fc 40 80 00    orl    $0x8040,-0x4(%rsp)
  401070:       00 
  401071:       0f ae 54 24 fc          ldmxcsr -0x4(%rsp)
  401076:       c3                      retq   
  401077:       66 0f 1f 84 00 00 00    nopw   0x0(%rax,%rax,1)
  40107e:       00 00 


module binary:

0000000000401050 <main>:
  401050:       48 83 ec 08             sub    $0x8,%rsp
  401054:       bf 04 20 40 00          mov    $0x402004,%edi
  401059:       e8 d2 ff ff ff          callq  401030 <puts@plt>
  40105e:       31 c0                   xor    %eax,%eax
  401060:       48 83 c4 08             add    $0x8,%rsp
  401064:       c3                      retq   
  401065:       66 66 2e 0f 1f 84 00    data16 nopw %cs:0x0(%rax,%rax,1)
  40106c:       00 00 00 00 

0000000000401070 <_GLOBAL__sub_I_main>:
  401070:       e9 0b 00 00 00          jmpq   401080 <_ZGIW5helloEv>
  401075:       66 2e 0f 1f 84 00 00    nopw   %cs:0x0(%rax,%rax,1)
  40107c:       00 00 00 
  40107f:       90                      nop

0000000000401080 <_ZGIW5helloEv>:
  401080:       80 3d b2 2f 00 00 00    cmpb   $0x0,0x2fb2(%rip)        #
404039 <_ZZ13_ZGIW5helloEvE9__in_chrg>
  401087:       75 07                   jne    401090 <_ZGIW5helloEv+0x10>
  401089:       c6 05 a9 2f 00 00 01    movb   $0x1,0x2fa9(%rip)        #
404039 <_ZZ13_ZGIW5helloEvE9__in_chrg>
  401090:       c3                      retq   
  401091:       66 2e 0f 1f 84 00 00    nopw   %cs:0x0(%rax,%rax,1)
  401098:       00 00 00 
  40109b:       0f 1f 44 00 00          nopl   0x0(%rax,%rax,1)

00000000004010a0 <set_fast_math>:
  4010a0:       f3 0f 1e fa             endbr64 
  4010a4:       0f ae 5c 24 fc          stmxcsr -0x4(%rsp)
  4010a9:       81 4c 24 fc 40 80 00    orl    $0x8040,-0x4(%rsp)
  4010b0:       00 
  4010b1:       0f ae 54 24 fc          ldmxcsr -0x4(%rsp)
  4010b6:       c3                      retq   
  4010b7:       66 0f 1f 84 00 00 00    nopw   0x0(%rax,%rax,1)
  4010be:       00 00

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

end of thread, other threads:[~2024-03-07 20:09 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-17 23:43 [Bug c++/98364] New: C++20 module binary bloat unlvsur at live dot com
2020-12-18 13:40 ` [Bug c++/98364] C++20 module global constructor emission nathan at gcc dot gnu.org
2020-12-21 18:41 ` nathan at gcc dot gnu.org
2020-12-21 18:44 ` unlvsur at live dot com
2020-12-21 18:44 ` unlvsur at live dot com
2020-12-21 18:45 ` unlvsur at live dot com
2020-12-21 18:51 ` unlvsur at live dot com
2020-12-21 18:53 ` unlvsur at live dot com
2022-01-01  5:48 ` [Bug c++/98364] [modules] unnneded global constructors are emitted for a module pinskia at gcc dot gnu.org
2024-03-07 20:09 ` ppalka 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).