<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 - [DebugInfo] Lifetime of function arguments is too short in optimized code."
   href="https://bugs.llvm.org/show_bug.cgi?id=39715">39715</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[DebugInfo] Lifetime of function arguments is too short in optimized code.
          </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>DebugInfo
          </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>aprantl@apple.com, friss@apple.com, jdevlieghere@apple.com, keith.walker@arm.com, llvm-bugs@lists.llvm.org, rnk@google.com, vk@vedantk.com, vsk@apple.com, zturner@google.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Same test case as before:

__attribute__((noinline))
int fn1 (long int x, long int y, long int z) {
        int l = x * 2;
        int q = y * z;
        return l + q;
}

__attribute__((noinline)) long int
fn2 (long int a, long int b, long int c)
{
  long int q = 2 * a;
  return fn1 (5, 6, 7);
}

int main(void) {
        return fn2(14, 23, 34);
}

(built with -O3 -g).
lldb session:

Process 30254 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = step in
    frame #0: 0x0000000100000f74 a.out`fn1(x=5, y=6, z=7) at optout.c:4:19
[opt]
   1    __attribute__((noinline))
   2    int fn1 (long int x, long int y, long int z) {
   3            int l = x * 2;
-> 4            int q = y * z;
   5            return l + q;
   6    }
   7    
(lldb) frame var z
(long) z = 7
(lldb) n
Process 30254 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = step over
    frame #0: 0x0000000100000f77 a.out`fn1(x=5, y=6, z=<unavailable>) at
optout.c:5:18 [opt]
   2    int fn1 (long int x, long int y, long int z) {
   3            int l = x * 2;
   4            int q = y * z;
-> 5            return l + q;
   6    }
   7    
   8    __attribute__((noinline)) long int
(lldb) frame var z
(long) z = <variable not available></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>