[llvm-bugs] [Bug 46208] New: Symbolization on Windows doesn't work accurately after inlining with std::function/lambdas

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jun 4 13:01:17 PDT 2020


https://bugs.llvm.org/show_bug.cgi?id=46208

            Bug ID: 46208
           Summary: Symbolization on Windows doesn't work accurately after
                    inlining with std::function/lambdas
           Product: new-bugs
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: aeubanks at google.com
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org

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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200604/2024ac3a/attachment.html>


More information about the llvm-bugs mailing list