<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 - Orphaned master directive in lambda crashes"
   href="https://bugs.llvm.org/show_bug.cgi?id=48571">48571</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Orphaned master directive in lambda crashes
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>OpenMP
          </td>
        </tr>

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

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

        <tr>
          <th>OS</th>
          <td>Linux
          </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>Clang Compiler Support
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>jdoerfert@anl.gov
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>a.bataev@hotmail.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>This (<a href="https://clang.godbolt.org/z/1f47K4">https://clang.godbolt.org/z/1f47K4</a>) crashes in clang right now:

```
void f(int a, int b) {

  auto l = [=]() {
#pragma omp master
    {
      int c = a + b;
    }
  };

  l();

}
```

stack trace

```
3.      <source>:4:12: Generating code for declaration 'f(int, int)::(anonymous
class)::operator()'
4.      <source>:6:5: LLVM IR generation of compound statement ('{}')
 #0 0x000055ba26506b6c llvm::sys::PrintStackTrace(llvm::raw_ostream&, int)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x2efbb6c)
 #1 0x000055ba26504904 llvm::sys::RunSignalHandlers()
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x2ef9904)
 #2 0x000055ba26504b95 llvm::sys::CleanupOnSignal(unsigned long)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x2ef9b95)
 #3 0x000055ba2646e9b8 CrashRecoverySignalHandler(int)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x2e639b8)
 #4 0x00007f131f2923c0 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x153c0)
 #5 0x000055ba26b0ec87 (anonymous
namespace)::CGOpenMPInlinedRegionInfo::getContextValue() const
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x3503c87)
 #6 0x000055ba26a60d45
clang::CodeGen::CodeGenFunction::EmitDeclRefLValue(clang::DeclRefExpr const*)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x3455d45)
 #7 0x000055ba26a5f2de clang::CodeGen::CodeGenFunction::EmitLValue(clang::Expr
const*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x34542de)
 #8 0x000055ba26a63887
clang::CodeGen::CodeGenFunction::EmitCheckedLValue(clang::Expr const*,
clang::CodeGen::CodeGenFunction::TypeCheckKind)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x3458887)
 #9 0x000055ba26a9afc9 (anonymous
namespace)::ScalarExprEmitter::EmitLoadOfLValue(clang::Expr const*)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x348ffc9)
#10 0x000055ba26a994c2 (anonymous
namespace)::ScalarExprEmitter::Visit(clang::Expr*)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x348e4c2)
#11 0x000055ba26a9f1e0 (anonymous
namespace)::ScalarExprEmitter::VisitCastExpr(clang::CastExpr*)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x34941e0)
#12 0x000055ba26a99297 (anonymous
namespace)::ScalarExprEmitter::Visit(clang::Expr*)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x348e297)
#13 0x000055ba26a9cabd (anonymous
namespace)::ScalarExprEmitter::EmitBinOps(clang::BinaryOperator const*)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x3491abd)
#14 0x000055ba26a9913c (anonymous
namespace)::ScalarExprEmitter::Visit(clang::Expr*)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x348e13c)
#15 0x000055ba26a9ac23
clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x348fc23)
#16 0x000055ba26a30a0f
clang::CodeGen::CodeGenFunction::EmitScalarInit(clang::Expr const*,
clang::ValueDecl const*, clang::CodeGen::LValue, bool)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x3425a0f)
#17 0x000055ba26a3137e
clang::CodeGen::CodeGenFunction::EmitExprAsInit(clang::Expr const*,
clang::ValueDecl const*, clang::CodeGen::LValue, bool)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x342637e)
#18 0x000055ba26a377ae
clang::CodeGen::CodeGenFunction::EmitAutoVarInit(clang::CodeGen::CodeGenFunction::AutoVarEmission
const&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x342c7ae)
#19 0x000055ba26a38885
clang::CodeGen::CodeGenFunction::EmitAutoVarDecl(clang::VarDecl const&)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x342d885)
#20 0x000055ba26a38b6d clang::CodeGen::CodeGenFunction::EmitDecl(clang::Decl
const&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x342db6d)
#21 0x000055ba267e13c7
clang::CodeGen::CodeGenFunction::EmitDeclStmt(clang::DeclStmt const&)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x31d63c7)
#22 0x000055ba267ef5b5
clang::CodeGen::CodeGenFunction::EmitSimpleStmt(clang::Stmt const*,
llvm::ArrayRef<clang::Attr const*>)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x31e45b5)
#23 0x000055ba267eb022 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt
const*, llvm::ArrayRef<clang::Attr const*>)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x31e0022)
#24 0x000055ba267eb6dc
clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt
const&, bool, clang::CodeGen::AggValueSlot)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x31e06dc)
#25 0x000055ba267eb9f3
clang::CodeGen::CodeGenFunction::EmitCompoundStmt(clang::CompoundStmt const&,
bool, clang::CodeGen::AggValueSlot)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x31e09f3)
#26 0x000055ba267ef4da
clang::CodeGen::CodeGenFunction::EmitSimpleStmt(clang::Stmt const*,
llvm::ArrayRef<clang::Attr const*>)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x31e44da)
#27 0x000055ba267eb022 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt
const*, llvm::ArrayRef<clang::Attr const*>)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x31e0022)
#28 0x000055ba26b14f0a
clang::CodeGen::RegionCodeGenTy::operator()(clang::CodeGen::CodeGenFunction&)
const (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3509f0a)
#29 0x000055ba26b1517f (anonymous
namespace)::CGOpenMPRegionInfo::EmitBody(clang::CodeGen::CodeGenFunction&,
clang::Stmt const*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x350a17f)
#30 0x000055ba26b1147e
clang::CodeGen::CGOpenMPRuntime::emitInlinedDirective(clang::CodeGen::CodeGenFunction&,
llvm::omp::Directive, clang::CodeGen::RegionCodeGenTy const&, bool)
(.part.1682) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x350647e)
#31 0x000055ba26b360fa
clang::CodeGen::CGOpenMPRuntime::emitMasterRegion(clang::CodeGen::CodeGenFunction&,
clang::CodeGen::RegionCodeGenTy const&, clang::SourceLocation)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x352b0fa)
#32 0x000055ba267f6f20
clang::CodeGen::CodeGenFunction::EmitOMPMasterDirective(clang::OMPMasterDirective
const&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x31ebf20)
#33 0x000055ba267eb459 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt
const*, llvm::ArrayRef<clang::Attr const*>)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x31e0459)
#34 0x000055ba267eb6dc
clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt
const&, bool, clang::CodeGen::AggValueSlot)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x31e06dc)
#35 0x000055ba268382a9
clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::Stmt const*)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x322d2a9)
#36 0x000055ba2683fa2e
clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl,
llvm::Function*, clang::CodeGen::CGFunctionInfo const&)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x3234a2e)
#37 0x000055ba26882198
clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl,
llvm::GlobalValue*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3277198)
#38 0x000055ba26880114
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl,
llvm::GlobalValue*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3275114)
#39 0x000055ba2688693a clang::CodeGen::CodeGenModule::EmitDeferred()
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x327b93a)
#40 0x000055ba268869ac clang::CodeGen::CodeGenModule::EmitDeferred()
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x327b9ac)
#41 0x000055ba26886d6c clang::CodeGen::CodeGenModule::Release()
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x327bd6c)
#42 0x000055ba2733e9a7 (anonymous
namespace)::CodeGeneratorImpl::HandleTranslationUnit(clang::ASTContext&)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x3d339a7)
#43 0x000055ba2733c975
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x3d31975)
#44 0x000055ba280f3669 clang::ParseAST(clang::Sema&, bool, bool)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x4ae8669)
#45 0x000055ba26d43281 clang::FrontendAction::Execute()
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x3738281)
#46 0x000055ba26ced0c3
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x36e20c3)
#47 0x000055ba26e0a933
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x37ff933)
#48 0x000055ba2454301c cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0xf3801c)
#49 0x000055ba2453f6cd ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0xf346cd)
#50 0x000055ba26bb3105 void llvm::function_ref<void
()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>
<span class="quote">>, std::__cxx11::basic_string<char, std::char_traits<char>,</span >
std::allocator<char> >*, bool*) const::'lambda'()>(long)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x35a8105)
#51 0x000055ba2646ea93
llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x2e63a93)
#52 0x000055ba26bb3c37
clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>
<span class="quote">>, std::__cxx11::basic_string<char, std::char_traits<char>,</span >
std::allocator<char> >*, bool*) const (.part.172)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x35a8c37)
#53 0x000055ba26b8c93a
clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&,
clang::driver::Command const*&) const
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x358193a)
#54 0x000055ba26b8d48f
clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&,
llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) const
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x358248f)
#55 0x000055ba26b963b5
clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&,
llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x358b3b5)
#56 0x000055ba2446cf76 main
(/opt/compiler-explorer/clang-trunk/bin/clang+++0xe61f76)
#57 0x00007f131ed430b3 __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x270b3)
#58 0x000055ba2453f24a _start
(/opt/compiler-explorer/clang-trunk/bin/clang+++0xf3424a)
```</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>