<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 - lldb printing shadowed local variable"
   href="https://bugs.llvm.org/show_bug.cgi?id=45564">45564</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>lldb printing shadowed local variable
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>lldb
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </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>All Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>lldb-dev@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>vsk@apple.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>jdevlieghere@apple.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>When we compile the following program at -O0 and step to the third printf, lldb
prints two values for "l", which is misleading. It should just print the
unshadowed one.

```
* thread #1, queue = 'com.apple.main-thread', stop reason = step over
    frame #0: 0x0000000100000f69 opt`main(argc=1, argv=0x00007ffeefbff8a8) at
opt.c:10:20
   7      {
   8        printf("%d\n", l);
   9        int l = 7;
-> 10       printf("%d\n", l);
   11     }
   12  
   13     return 0;
(lldb) frame variable
(int) argc = 1
(char **) argv = 0x00007ffeefbff8a8
(int) l = 6
(int) l = 7
```

Program:

```
#include <stdio.h>

int main(int argc, char **argv) {
  int l = 6;
  printf("%d\n", l);

  {
    printf("%d\n", l);
    int l = 7;
    printf("%d\n", l);
  }

  return 0;
}

```</pre>
        </div>
      </p>


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

      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>