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: unassignedb...@nondot.org
          Reporter: tlw...@uwaterloo.ca
                CC: cn...@uwaterloo.ca, llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to