<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] Arguments are lost after a call across TUs"
   href="https://bugs.llvm.org/show_bug.cgi?id=39724">39724</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[DebugInfo] Arguments are lost after a call across TUs
          </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, paul_robinson@playstation.sony.com, rnk@google.com, vk@vedantk.com, vsk@apple.com, zturner@google.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Testcase (two TUs):

a.c:

extern void other_func(long int, long int, long int);

__attribute__((noinline))
        int fn1 (long int x, long int y, long int z) {
                        int l = x * 2;
                                int q = y * z;
                                other_func(x, 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);
}

b.c:

void other_func(long int a, long int b, long int c) {}


built with: ${CC} a.c b.c -O3 -g


clang + lldb:

Process 38226 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = step over
    frame #0: 0x0000000100000f64 a.out`fn1(x=5, y=<unavailable>,
z=<unavailable>) at optout.c:8:12 [opt]
   5      int l = x * 2;
   6      int q = y * z;
   7      other_func(x, y, z);
-> 8      return l + q;
   9    }
   10   
   11   __attribute__((noinline)) long int
(lldb) frame var 
(long) x = 5
(long) y = <variable not available>

(long) z = <variable not available>

(int) q = 42
(int) l = <no location, value may have been optimized out>

gcc + gdb:

fn1 (x=x@entry=5, y=y@entry=6, z=z@entry=7) at opt.c:5
5                               int l = x * 2;
(gdb) n
7                                       other_func(x, y, z);
(gdb) n
8                                               return l + q;
(gdb) info locals
l = 10
q = 42
(gdb) info args
x = 5
y = 6
z = 7</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>