[llvm-bugs] [Bug 39694] New: [OpenMP] Seg-fault caused by this-capturing lambda in #pragma omp parallel

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Nov 16 10:26:45 PST 2018


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

            Bug ID: 39694
           Summary: [OpenMP] Seg-fault caused by this-capturing lambda in
                    #pragma omp parallel
           Product: OpenMP
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Clang Compiler Support
          Assignee: unassignedclangbugs at nondot.org
          Reporter: erich.keane at intel.com
                CC: llvm-bugs at lists.llvm.org

AS of r345609, OpenMP supports mapping lambdas in target regions. However, if
the lambda captures 'this', and we're no-longer local to the lambda's 'this',
the call on this line:
(https://github.com/llvm-mirror/clang/commit/36950cc24f63a783faf9a3db208120b496fd8a84#diff-fb23039c21cc555ae2fb3106a2426fb5R1555

to CheckCXXThisCapture seg-faults because the Sema "Active This Type" doesn't
exist.

Godbolt link here: https://godbolt.org/z/W26nsv


Min Reproducer is:
template <typename _Op> void algo(_Op __o) {
   #pragma omp parallel
     (void)__o;
 }

 struct S {
   void Foo() {
    algo([this]() {});
  }
};


NOTE that the crash only happens when this is a 'free' function.  More
insidiously, if the algorithm itself is in a structure
(https://godbolt.org/z/_aKG6l), 'this' will capture the wrong thing (see line
36 in the AST output).

-- 
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/20181116/611438d1/attachment.html>


More information about the llvm-bugs mailing list