<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 - COFF Debug info shows variable at the wrong lexical scope."
   href="https://bugs.llvm.org/show_bug.cgi?id=43860">43860</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>COFF Debug info shows variable at the wrong lexical scope.
          </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>international.phantom@gmail.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>Given the following test case:

//------------------------------------------------------------
// inlined.cpp
//------------------------------------------------------------

int inlineFunction(int Param) __attribute__((always_inline));
int inlineFunction(int Param) {
  int Var_1 = Param;
  {
    int Var_2 = Param + Var_1;
    Var_1 = Var_2;
  }
  return Var_1;
}

int testInlined(int Param_1, int Param_2) {
  int A = Param_1;
  A += inlineFunction(Param_2);
  return A;
}

//------------------------------------------------------------

Using the following command line options to generate debug info
(DWARF) and (COFF):

clang -c -g -O0 inlined.cpp -o inlined-dwarf.o
clang -c -g -O0 inlined.cpp -o inlined-coff.o -gcodeview
--target=x86_64-windows

Looking at the output generated by llvm-dwarfdump and llvm-readobj,
the COFF debug info shows the variable 'Var_2' at the same lexical
scope as the variable 'Var_1' in the 'testInlined' as results of the
function 'inlineFunction' being inlined.

llvm-dwarfdump --debug-info inlined-dwarf.o</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>