<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 - Wrong debug info generated at -O1 (-O0 is correct)"
   href="https://bugs.llvm.org/show_bug.cgi?id=40944">40944</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Wrong debug info generated at -O1 (-O0 is correct)
          </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>Keywords</th>
          <td>wrong-debug
          </td>
        </tr>

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

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

        <tr>
          <th>Component</th>
          <td>Scalar Optimizations
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>davide@freebsd.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>$ cat 1.c
unsigned char a;
char b = -1;
int main() {
  int l_135 = 1102062129;
  l_135 = (a = b) | 9;
  optimize_me_not();
}

$ cat outer.c
void optimize_me_not() {}

### -O0

* thread #1, name = 'a.out', stop reason = breakpoint 2.1
    frame #0: 0x00000000004004a6 a.out`main at 1.c:6:3
   3    int main() {
   4      int l_135 = 1102062129;
   5      l_135 = (a = b) | 9;
-> 6      optimize_me_not();
   7    }
(lldb) frame var
(int) l_135 = 255

### -O1

* thread #1, name = 'a.out', stop reason = breakpoint 1.1
    frame #0: 0x000000000040048d a.out`main at 1.c:6:3
   3    int main() {
   4      int l_135 = 1102062129;
   5      l_135 = (a = b) | 9;
-> 6      optimize_me_not();
   7    }
(lldb) frame var
(lldb) frame var l_135
(int) l_135 = 1102062129


$ clang-trunk --version
clang version 9.0.0 (trunk 355281)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin

$ lldb-trunk --version
lldb version 9.0.0 (<a href="https://llvm.org/svn/llvm-project/lldb/trunk">https://llvm.org/svn/llvm-project/lldb/trunk</a> revision
355281)
  clang revision 355281
  llvm revision 355281</pre>
        </div>
      </p>


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

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