[llvm-bugs] [Bug 51571] New: Emitted binary code changes at -O0 when compiling through -S
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Aug 20 18:35:47 PDT 2021
https://bugs.llvm.org/show_bug.cgi?id=51571
Bug ID: 51571
Summary: Emitted binary code changes at -O0 when compiling
through -S
Product: libraries
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: Common Code Generator Code
Assignee: unassignedbugs at nondot.org
Reporter: tlwang at uwaterloo.ca
CC: cnsun at uwaterloo.ca, llvm-bugs at lists.llvm.org
The .text section of program.c changes when the program is compiled through -S.
$ cat program.c
int a;
void b() {
if (a)
;
}
int main() {}
$
$ clang-trunk -v
clang version 14.0.0 (https://github.com/llvm/llvm-project.git
3890ce708d4f94d0326172650ce22262f6b56661)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/cnsun/usr/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/10
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/9
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/10
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
$
$ clang-trunk -O0 -c program.c ; objdump --disassemble --section=.text
program.o > no_s.txt
$ clang-trunk -O0 -S program.c ; clang-trunk -O0 -c program.s ; objdump
--disassemble --section=.text program.o > s.txt
$ diff s.txt no_s.txt
12,18c12,16
< c: 74 02 je 10 <b+0x10>
< e: eb 00 jmp 10 <b+0x10>
< 10: 5d pop %rbp
< 11: c3 retq
< 12: 66 2e 0f 1f 84 00 00 nopw %cs:0x0(%rax,%rax,1)
< 19: 00 00 00
< 1c: 0f 1f 40 00 nopl 0x0(%rax)
---
> c: 0f 84 05 00 00 00 je 17 <b+0x17>
> 12: e9 00 00 00 00 jmpq 17 <b+0x17>
> 17: 5d pop %rbp
> 18: c3 retq
> 19: 0f 1f 80 00 00 00 00 nopl 0x0(%rax)
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210821/fea5dad0/attachment-0001.html>
More information about the llvm-bugs
mailing list