public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug lto/107030] New: Emitted binary code changes when -g is enabled at -O2 -flto and optimize attribute
@ 2022-09-25 4:34 tlwang at uwaterloo dot ca
2022-09-25 4:51 ` [Bug lto/107030] " pinskia at gcc dot gnu.org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: tlwang at uwaterloo dot ca @ 2022-09-25 4:34 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107030
Bug ID: 107030
Summary: Emitted binary code changes when -g is enabled at -O2
-flto and optimize attribute
Product: gcc
Version: 13.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_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/13.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /tmp/tmp.O2a2UsOhYi-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 13.0.0 20220924 (experimental) [master -g4afaeaab5] (GCC)
$ cat attributes_program0_preprocessed.c
int a;
union {
char b;
long c;
} d = {0};
void e(f) { g(d.b); }
__attribute__((optimize(0))) static short h() {
e(d.c);
int i = a;
}
void g(j) {}
int main() {}
$ gcc-trunk -w -flto -O2 attributes_program0_preprocessed.c -o a.out; objdump
--disassemble --section=.text a.out > no_dbg.txt
$ gcc-trunk -w -flto -O2 attributes_program0_preprocessed.c -g -o a.out;
objdump --disassemble --section=.text a.out > dbg.txt
$ diff no_dbg.txt dbg.txt
96c96
< 401124: 8b 05 de 0e 00 00 mov 0xede(%rip),%eax # 402008
<a>
---
> 401124: 8b 05 da 0e 00 00 mov 0xeda(%rip),%eax # 402004 <a>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug lto/107030] Emitted binary code changes when -g is enabled at -O2 -flto and optimize attribute
2022-09-25 4:34 [Bug lto/107030] New: Emitted binary code changes when -g is enabled at -O2 -flto and optimize attribute tlwang at uwaterloo dot ca
@ 2022-09-25 4:51 ` pinskia at gcc dot gnu.org
2022-09-25 6:49 ` schwab@linux-m68k.org
2022-09-26 9:25 ` rguenth at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-09-25 4:51 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107030
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I doubt this is a bug.
The difference is in the got.
If anything the got is slightly different.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug lto/107030] Emitted binary code changes when -g is enabled at -O2 -flto and optimize attribute
2022-09-25 4:34 [Bug lto/107030] New: Emitted binary code changes when -g is enabled at -O2 -flto and optimize attribute tlwang at uwaterloo dot ca
2022-09-25 4:51 ` [Bug lto/107030] " pinskia at gcc dot gnu.org
@ 2022-09-25 6:49 ` schwab@linux-m68k.org
2022-09-26 9:25 ` rguenth at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: schwab@linux-m68k.org @ 2022-09-25 6:49 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107030
--- Comment #2 from Andreas Schwab <schwab@linux-m68k.org> ---
But -g is supposed to never change the generated code.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug lto/107030] Emitted binary code changes when -g is enabled at -O2 -flto and optimize attribute
2022-09-25 4:34 [Bug lto/107030] New: Emitted binary code changes when -g is enabled at -O2 -flto and optimize attribute tlwang at uwaterloo dot ca
2022-09-25 4:51 ` [Bug lto/107030] " pinskia at gcc dot gnu.org
2022-09-25 6:49 ` schwab@linux-m68k.org
@ 2022-09-26 9:25 ` rguenth at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-09-26 9:25 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107030
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2022-09-26
Keywords| |compare-debug-failure
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
The difference is that with -g 'd' is not emitted:
@@ -46,10 +57,217 @@
.size a, 4
a:
.zero 4
- .align 8
- .type d, @object
- .size d, 8
-d:
- .zero 8
+ .text
+.Letext0:
+ .section .debug_info,"",@progbits
with just -fwhole-program but without -flto 'd' is emitted in both cases.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-09-26 9:25 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-25 4:34 [Bug lto/107030] New: Emitted binary code changes when -g is enabled at -O2 -flto and optimize attribute tlwang at uwaterloo dot ca
2022-09-25 4:51 ` [Bug lto/107030] " pinskia at gcc dot gnu.org
2022-09-25 6:49 ` schwab@linux-m68k.org
2022-09-26 9:25 ` rguenth 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).