public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug lto/104237] New: Emitted binary code changes when -g is enabled at -O1 -flto
@ 2022-01-26  6:06 tlwang at uwaterloo dot ca
  2022-01-26  6:13 ` [Bug lto/104237] Emitted binary code changes when -g is enabled at -O1 -flto and optimize attribute pinskia at gcc dot gnu.org
                   ` (21 more replies)
  0 siblings, 22 replies; 23+ messages in thread
From: tlwang at uwaterloo dot ca @ 2022-01-26  6:06 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 104237
           Summary: Emitted binary code changes when -g is enabled at -O1
                    -flto
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: lto
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tlwang at uwaterloo dot ca
                CC: marxin at gcc dot gnu.org
  Target Milestone: ---

This occurs when compiling attributes_transformed_program0_preprocessed.c, as
shown below.

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/scratch/software/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/12.0.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /tmp/tmp.scGtRTj8uf-gcc-builder/gcc/configure
--enable-languages=c,c++,lto --enable-checking-yes --enable-multiarch
--prefix=/scratch/software/gcc-trunk --disable-bootstrap
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.1 20220125 (experimental) [master -gf4ee27d32] (GCC)
$ cat attributes_transformed_program0_preprocessed.c
# 6 ""
short a;
__attribute__((optimize(0))) int b();
__attribute__((always_inline)) signed char c();
int b() {
  char e = c();
  return a;
}
signed char c(f) {
  d();
# 7 "attributes_transformed_program0.c"
  int g;
# 6
  return f;
}
void d() {}
int main() {}
$ gcc-trunk -w -O1 -flto attributes_transformed_program0_preprocessed.c -o
a.out
$ objdump --disassemble --section=.text a.out > no_debug.txt
$ gcc-trunk -w -O1 -flto -g attributes_transformed_program0_preprocessed.c -o
a.out
$ objdump --disassemble --section=.text a.out > debug.txt
$ diff debug.txt no_debug.txt
18c18
<   401041:     48 c7 c7 1e 11 40 00    mov    $0x40111e,%rdi
---
>   401041:	48 c7 c7 1d 11 40 00 	mov    $0x40111d,%rdi
88,91c88,91
<   40110d:     90                      nop
<   40110e:     88 45 ff                mov    %al,-0x1(%rbp)
<   401111:     0f b7 05 ec 0e 00 00    movzwl 0xeec(%rip),%eax        # 402004
<a>
<   401118:     98                      cwtl
---
>   40110d:	88 45 ff             	mov    %al,-0x1(%rbp)
>   401110:	0f b7 05 ed 0e 00 00 	movzwl 0xeed(%rip),%eax        # 402004 <a>
>   401117:	98                   	cwtl
>   401118:	90                   	nop
93,95c93,94
<   40111a:     90                      nop
<   40111b:     5d                      pop    %rbp
<   40111c:     c3                      retq
---
>   40111a:	5d                   	pop    %rbp
>   40111b:	c3                   	retq
97,98c96,97
< 000000000040111d <d>:
<   40111d:     c3                      retq
---
> 000000000040111c <d>:
>   40111c:	c3                   	retq
100,105c99,104
< 000000000040111e <main>:
<   40111e:     b8 00 00 00 00          mov    $0x0,%eax
<   401123:     c3                      retq
<   401124:     66 2e 0f 1f 84 00 00    nopw   %cs:0x0(%rax,%rax,1)
<   40112b:     00 00 00
<   40112e:     66 90                   xchg   %ax,%ax
---
> 000000000040111d <main>:
>   40111d:	b8 00 00 00 00       	mov    $0x0,%eax
>   401122:	c3                   	retq
>   401123:	66 2e 0f 1f 84 00 00 	nopw   %cs:0x0(%rax,%rax,1)
>   40112a:	00 00 00
>   40112d:	0f 1f 00             	nopl   (%rax)

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

end of thread, other threads:[~2022-06-01 17:12 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-26  6:06 [Bug lto/104237] New: Emitted binary code changes when -g is enabled at -O1 -flto tlwang at uwaterloo dot ca
2022-01-26  6:13 ` [Bug lto/104237] Emitted binary code changes when -g is enabled at -O1 -flto and optimize attribute pinskia at gcc dot gnu.org
2022-01-26  8:39 ` [Bug lto/104237] [11/12 Regression] Emitted binary code changes when -g is enabled at -O1 -flto and optimize attribute since r11-3126-ga8f9b4c54cc35062 marxin at gcc dot gnu.org
2022-01-27 14:59 ` jakub at gcc dot gnu.org
2022-01-27 16:26 ` jakub at gcc dot gnu.org
2022-01-27 18:46 ` jakub at gcc dot gnu.org
2022-01-27 18:46 ` jakub at gcc dot gnu.org
2022-01-27 18:58 ` dmalcolm at gcc dot gnu.org
2022-01-28 10:49 ` cvs-commit at gcc dot gnu.org
2022-01-28 10:57 ` [Bug lto/104237] [11 " jakub at gcc dot gnu.org
2022-01-29  6:35 ` cnsun at uwaterloo dot ca
2022-01-29  9:07 ` jakub at gcc dot gnu.org
2022-02-19  8:02 ` cvs-commit at gcc dot gnu.org
2022-02-19  8:06 ` jakub at gcc dot gnu.org
2022-02-23 16:03 ` cnsun at uwaterloo dot ca
2022-03-08 20:34 ` cnsun at uwaterloo dot ca
2022-03-08 20:48 ` pinskia at gcc dot gnu.org
2022-03-08 20:49 ` jakub at gcc dot gnu.org
2022-03-08 21:07 ` cnsun at uwaterloo dot ca
2022-06-01 15:02 ` cnsun at uwaterloo dot ca
2022-06-01 16:23 ` pinskia at gcc dot gnu.org
2022-06-01 16:42 ` jakub at gcc dot gnu.org
2022-06-01 17:12 ` cnsun at uwaterloo dot ca

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).