[llvm-bugs] [Bug 51569] New: Emitted binary code changes when -g is enabled at -O0 -m32

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Aug 20 18:21:52 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=51569

            Bug ID: 51569
           Summary: Emitted binary code changes when -g is enabled at -O0
                    -m32
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Loop Optimizer
          Assignee: unassignedbugs at nondot.org
          Reporter: tlwang at uwaterloo.ca
                CC: cnsun at uwaterloo.ca, llvm-bugs at lists.llvm.org
            Blocks: 37728

The .text section for the following program (program.c) changes after toggling
the -g flag.

$ cat program.c
int a, b;
void c() {
  for (;;)
    ;
}
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 -c -m32 -O0 program.c ; objdump --disassemble --section=.text
program.o > no_g.txt
$ clang-trunk -c -m32 -O0 -g program.c ; objdump --disassemble --section=.text
program.o > g.txt
$ diff no_g.txt g.txt
10,11c10,11
<    3: e9 00 00 00 00          jmp    8 <b+0x4>
<    8: e9 fb ff ff ff          jmp    8 <b+0x4>
---
>    3:	e9 00 00 00 00       	jmp    8 <c+0x8>
>    8:	e9 fb ff ff ff       	jmp    8 <c+0x8>


Referenced Bugs:

https://bugs.llvm.org/show_bug.cgi?id=37728
[Bug 37728] [meta] Make llvm passes debug info invariant
-- 
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/6dc983a0/attachment.html>


More information about the llvm-bugs mailing list