<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 - Symbolization on Windows doesn't work accurately after inlining with std::function/lambdas"
   href="https://bugs.llvm.org/show_bug.cgi?id=46208">46208</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Symbolization on Windows doesn't work accurately after inlining with std::function/lambdas
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Windows NT
          </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>new bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>aeubanks@google.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>While looking at failures under the new pass manager,
compiler-rt/test/asan/TestCases/use-after-scope-capture.cpp came up.

int main() {
  std::function<int()> f;
  {
    int x = 0;
    f = [&x]() ATTR {
      return x;  // BOOM
      // CHECK: ERROR: AddressSanitizer: stack-use-after-scope
      // CHECK: #0 0x{{.*}} in {{.*}}use-after-scope-capture.cpp:[[@LINE-2]]
    };
  }
  return f();  // BOOM
}

The stack trace when there is inlining (legacy PM at -O2 or higher, or new PM
at -O1 or higher) for the ASan failure is

    #0 0x7ff6e956171b in std::_Func_impl_no_alloc<`lambda at
C:/src/llvm-project/compiler-rt/test/asan/TestCases/use-after-scope-capture.cpp:20:9',int>::_Do_call
C:\PROGRA~2\MICROS~1\2017\PROFES~1\VC\Tools\MSVC\14.16.27023\include\functional:1225
    #1 0x7ff6e9561287 in main
C:\src\llvm-project\compiler-rt\test\asan\TestCases\use-after-scope-capture.cpp:26:10
    #2 0x7ff6e95d3f9f in __scrt_common_main_seh
d:\agent\_work\2\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288
    #3 0x7ffad9577bd3  (C:\Windows\System32\KERNEL32.DLL+0x180017bd3)
    #4 0x7ffadaeece50  (C:\Windows\SYSTEM32\ntdll.dll+0x18006ce50)

Which points to the `f = [&x]() {` line instead of the `return x;` line.
Without inlining this issue doesn't occur. This entire issue is not a problem
on Linux.</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>