<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/-O2/-O3 (-O0 is correct)"
   href="https://bugs.llvm.org/show_bug.cgi?id=40834">40834</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Wrong debug info generated at -O1/-O2/-O3 (-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 2.c
int a;
int *b = &a;
int main() {
  int c = *b;
  short l_504 = 1;
  if (c) {
    l_504 = -23;
    b = 0;
  }
  optimize_me_not();
}


$ cat outer.c
void optimize_me_not() {}

$ lldb-trunk ./a.out
(lldb) target create "./a.out"
Current executable set to './a.out' (x86_64).
(lldb) br set -p optimize_me_not
Breakpoint 1: where = a.out`main + 62 at 2.c:10:3, address = 0x00000000004004be
(lldb) r
Process 1246 launched: '/home/davide/finished_reducing/a.out' (x86_64)
Process 1246 stopped
* thread #1, name = 'a.out', stop reason = breakpoint 1.1
    frame #0: 0x00000000004004be a.out`main at 2.c:10:3
   7        l_504 = -23;
   8        b = 0;
   9      }
-> 10     optimize_me_not();
   11   }
(lldb) p l_504
(short) $0 = 1


(lldb) br set -p optimize_me_not
Breakpoint 1: where = a.out`main + 24 at 2.c:10:3, address = 0x0000000000400498
(lldb) r
Process 4538 launched: '/home/davide/finished_reducing/a.out' (x86_64)
Process 4538 stopped
* thread #1, name = 'a.out', stop reason = breakpoint 1.1
    frame #0: 0x0000000000400498 a.out`main at 2.c:10:3
   7        l_504 = -23;
   8        b = 0;
   9      }
-> 10     optimize_me_not();
   11   }
(lldb) p l_504
(short) $0 = -23</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>