<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Emitted binary code changes when -g is enabled at -O0 -m32"
   href="https://bugs.llvm.org/show_bug.cgi?id=51569">51569</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Emitted binary code changes when -g is enabled at -O0 -m32
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Loop Optimizer
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>tlwang@uwaterloo.ca
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>cnsun@uwaterloo.ca, llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Blocks</th>
          <td>37728
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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 (<a href="https://github.com/llvm/llvm-project.git">https://github.com/llvm/llvm-project.git</a>
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>
---
<span class="quote">>    3:  e9 00 00 00 00          jmp    8 <c+0x8>
>    8:      e9 fb ff ff ff          jmp    8 <c+0x8></span ></pre>
        </div>
      </p>

        <div id="referenced">
          <hr style="border: 1px dashed #969696">
          <b>Referenced Bugs:</b>
          <ul>
              <li>
                [<a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [meta] Make llvm passes debug info invariant"
   href="https://bugs.llvm.org/show_bug.cgi?id=37728">Bug 37728</a>] [meta] Make llvm passes debug info invariant
              </li>
          </ul>
        </div>
        <br>

      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>