<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 - Missing variables after inlining pass at O3"
   href="https://bugs.llvm.org/show_bug.cgi?id=49973">49973</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Missing variables after inlining pass at O3
          </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>Linux
          </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>cristianassaiante@outlook.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>jdevlieghere@apple.com, keith.walker@arm.com, llvm-bugs@lists.llvm.org, paul_robinson@playstation.sony.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Upon calling a function from an external module, the variable l_128 passed to
it is not visible from lldb. Using -opt-bisect-limit we discovered that the
pass causing the symbols disappear is "InlinerPass on SCC".


$ cat a.c
enum {
a
}b ;
void  c()
{
int l_128 = b = 4;
for (; b ; b = 0)
l_128 = 1;
test_nop();
test_support_3008(l_128);
}
int main ()
{
c();
}
$ cat lib/test.c
#include <stdio.h>
#include <stdint.h>
#include "test.h"

void test_nop() {
    printf("\n");
}

void test_support_3008(int l_128) {
    printf("%d", l_128);
}

$ cat lib/test.h
#pragma once

void test_nop();
void test_support_3008(int l_128);

$ clang -v
clang version 13.0.0
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.5.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/8
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.5.0
Candidate multilib: .;@m64
Selected multilib: .;@m64

$ lldb -v
lldb version 13.0.0

clang revision c2c977ce50597b0e5186afc342c5784bd0aa6973
lldb revision c2c977ce50597b0e5186afc342c5784bd0aa6973

$ clang -g -O3 -o opt lib/test.c a.c
$ lldb opt
(lldb) target create "opt"
Current executable set to
'/home/stepping/debuginfo-analysis/bug_submission/opt' (x86_64).
(lldb) b 10
Breakpoint 1: 2 locations.
(lldb) r
Process 27 launched: '/home/stepping/debuginfo-analysis/bug_submission/opt'
(x86_64)

Process 27 stopped
* thread #1, name = 'opt', stop reason = breakpoint 1.2
    frame #0: 0x0000000000400572 opt`main [inlined] c at a.c:10:1
   7    for (; b ; b = 0)
   8    l_128 = 1;
   9    test_nop();
-> 10   test_support_3008(l_128);
   11   }
   12   int main ()
   13   {
(lldb) frame var
(lldb) frame var l_128
error: no variable named 'l_128' found in this frame</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>