<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 - [openmp] CodeGenFunction.h: Assertion `it != OpaqueRValues.end() && "no mapping for opaque value!"' failed."
   href="https://bugs.llvm.org/show_bug.cgi?id=34927">34927</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[openmp] CodeGenFunction.h: Assertion `it != OpaqueRValues.end() && "no mapping for opaque value!"' failed.
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </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>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>sergey.nesterov@intel.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>========================main.cpp========================
void add(short &out, short &in) {}

#pragma omp declare reduction (my_add : short : add(omp_out, omp_in))

void foo() {
    short y[1];
    #pragma omp parallel for reduction(my_add:y)
    for(int i = 0; i < 1; i++) {}
}
======================================================

$ clang -v
clang version 6.0.0 (trunk 315575)
Target: x86_64-unknown-linux-gnu
Thread model: posix
...

$ clang++ -c -O0 -fopenmp main.cpp
clang-6.0: .../llvm/tools/clang/lib/CodeGen/CodeGenFunction.h:2141: const
clang::CodeGen::RValue&
clang::CodeGen::CodeGenFunction::getOpaqueRValueMapping(const
clang::OpaqueValueExpr*): Assertion `it != OpaqueRValues.end() && "no mapping
for opaque value!"' failed.
#0 0x0000000003ff8725 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
.../llvm/lib/Support/Unix/Signals.inc:398:0
#1 0x0000000003ff87b6 PrintStackTraceSignalHandler(void*)
.../llvm/lib/Support/Unix/Signals.inc:462:0
#2 0x0000000003ff6ca2 llvm::sys::RunSignalHandlers()
.../llvm/lib/Support/Signals.cpp:49:0
#3 0x0000000003ff80bd SignalHandler(int)
.../llvm/lib/Support/Unix/Signals.inc:252:0
#4 0x00007fb3cb325100 __restore_rt (/lib64/libpthread.so.0+0xf100)
#5 0x00007fb3c9f1d5f7 __GI_raise (/lib64/libc.so.6+0x355f7)
#6 0x00007fb3c9f1ece8 __GI_abort (/lib64/libc.so.6+0x36ce8)
#7 0x00007fb3c9f16566 __assert_fail_base (/lib64/libc.so.6+0x2e566)
#8 0x00007fb3c9f16612 (/lib64/libc.so.6+0x2e612)
#9 0x000000000460c40d
clang::CodeGen::CodeGenFunction::getOpaqueRValueMapping(clang::OpaqueValueExpr
const*) .../llvm/tools/clang/lib/CodeGen/CodeGenFunction.h:2141:0
#10 0x000000000460e77b (anonymous
namespace)::ScalarExprEmitter::VisitOpaqueValueExpr(clang::OpaqueValueExpr*)
.../llvm/tools/clang/lib/CodeGen/CGExprScalar.cpp:428:0
#11 0x0000000004622763 clang::StmtVisitorBase<clang::make_ptr, (anonymous
namespace)::ScalarExprEmitter, llvm::Value*>::Visit(clang::Stmt*)
.../tools/clang/include/clang/AST/StmtNodes.inc:711:0
#12 0x000000000460e154 (anonymous
namespace)::ScalarExprEmitter::Visit(clang::Expr*)
.../llvm/tools/clang/lib/CodeGen/CGExprScalar.cpp:358:0
#13 0x0000000004620424
clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool)
.../llvm/tools/clang/lib/CodeGen/CGExprScalar.cpp:3831:0
#14 0x00000000045ddf8f clang::CodeGen::CodeGenFunction::EmitCallee(clang::Expr
const*) .../llvm/tools/clang/lib/CodeGen/CGExpr.cpp:4200:0
#15 0x00000000045ddb50
clang::CodeGen::CodeGenFunction::EmitCallExpr(clang::CallExpr const*,
clang::CodeGen::ReturnValueSlot)
.../llvm/tools/clang/lib/CodeGen/CGExpr.cpp:4138:0
#16 0x000000000460eefa (anonymous
namespace)::ScalarExprEmitter::VisitCallExpr(clang::CallExpr const*)
.../llvm/tools/clang/lib/CodeGen/CGExprScalar.cpp:517:0
#17 0x00000000046221f3 clang::StmtVisitorBase<clang::make_ptr, (anonymous
namespace)::ScalarExprEmitter, llvm::Value*>::Visit(clang::Stmt*)
.../tools/clang/include/clang/AST/StmtNodes.inc:329:0
#18 0x000000000460e154 (anonymous
namespace)::ScalarExprEmitter::Visit(clang::Expr*)
.../llvm/tools/clang/lib/CodeGen/CGExprScalar.cpp:358:0
#19 0x0000000004620424
clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool)
.../llvm/tools/clang/lib/CodeGen/CGExprScalar.cpp:3831:0
#20 0x00000000045c69b4
clang::CodeGen::CodeGenFunction::EmitAnyExprToMem(clang::Expr const*,
clang::CodeGen::Address, clang::Qualifiers, bool)
.../llvm/tools/clang/lib/CodeGen/CGExpr.cpp:219:0
#21 0x0000000004684b75 EmitOMPAggregateInit(clang::CodeGen::CodeGenFunction&,
clang::CodeGen::Address, clang::QualType, clang::Expr const*,
clang::OMPDeclareReductionDecl const*, clang::CodeGen::Address)
.../llvm/tools/clang/lib/CodeGen/CGOpenMPRuntime.cpp:841:0
#22 0x0000000004684fc6
clang::CodeGen::ReductionCodeGen::emitAggregateInitialization(clang::CodeGen::CodeGenFunction&,
unsigned int, clang::CodeGen::Address, clang::CodeGen::LValue,
clang::OMPDeclareReductionDecl const*)
.../llvm/tools/clang/lib/CodeGen/CGOpenMPRuntime.cpp:886:0
#23 0x0000000004686866
clang::CodeGen::ReductionCodeGen::emitInitialization(clang::CodeGen::CodeGenFunction&,
unsigned int, clang::CodeGen::Address, clang::CodeGen::LValue,
llvm::function_ref<bool (clang::CodeGen::CodeGenFunction&)>)
.../llvm/tools/clang/lib/CodeGen/CGOpenMPRuntime.cpp:987:0
#24 0x00000000043279eb
clang::CodeGen::CodeGenFunction::EmitOMPReductionClauseInit(clang::OMPExecutableDirective
const&, clang::CodeGen::CodeGenFunction::OMPPrivateScope&)
.../llvm/tools/clang/lib/CodeGen/CGStmtOpenMP.cpp:987:0
#25 0x000000000432ece5
clang::CodeGen::CodeGenFunction::EmitOMPWorksharingLoop(clang::OMPLoopDirective
const&, clang::Expr*, llvm::function_ref<std::pair<clang::CodeGen::LValue,
clang::CodeGen::LValue> (clang::CodeGen::CodeGenFunction&,
clang::OMPExecutableDirective const&)> const&,
llvm::function_ref<std::pair<llvm::Value*, llvm::Value*>
(clang::CodeGen::CodeGenFunction&, clang::OMPExecutableDirective const&,
clang::CodeGen::Address, clang::CodeGen::Address)> const&)
.../llvm/tools/clang/lib/CodeGen/CGStmtOpenMP.cpp:2212:0
#26 0x0000000004331ebc operator()
.../llvm/tools/clang/lib/CodeGen/CGStmtOpenMP.cpp:2632:0
#27 0x0000000004331ebc
clang::CodeGen::CodeGenFunction::EmitOMPParallelForDirective(clang::OMPParallelForDirective
const&)::{lambda(clang::CodeGen::CodeGenFunction&,
clang::CodeGen::PrePostActionTy&)#1}::operator()(clang::CodeGen::CodeGenFunction&,
clang::CodeGen::PrePostActionTy&) const (.../bin/clang-6.0+0x4331ebc)
#28 0x000000000433e3a1 void
clang::CodeGen::RegionCodeGenTy::CallbackFn<clang::CodeGen::CodeGenFunction::EmitOMPParallelForDirective(clang::OMPParallelForDirective
const&)::{lambda(clang::CodeGen::CodeGenFunction&,
clang::CodeGen::PrePostActionTy&)#1}>(long, clang::CodeGen::CodeGenFunction&,
clang::CodeGen::PrePostActionTy&)
.../llvm/tools/clang/lib/CodeGen/CGOpenMPRuntime.h:75:0
#29 0x0000000004683e77
clang::CodeGen::RegionCodeGenTy::operator()(clang::CodeGen::CodeGenFunction&)
const .../llvm/tools/clang/lib/CodeGen/CGOpenMPRuntime.cpp:710:0
#30 0x0000000004687e1a (anonymous
namespace)::CGOpenMPRegionInfo::EmitBody(clang::CodeGen::CodeGenFunction&,
clang::Stmt const*) .../llvm/tools/clang/lib/CodeGen/CGOpenMPRuntime.cpp:1129:0
#31 0x0000000004323fcf
clang::CodeGen::CodeGenFunction::GenerateOpenMPCapturedStmtFunction(clang::CapturedStmt
const&) .../llvm/tools/clang/lib/CodeGen/CGStmtOpenMP.cpp:485:0
#32 0x0000000004689100
emitParallelOrTeamsOutlinedFunction(clang::CodeGen::CodeGenModule&,
clang::OMPExecutableDirective const&, clang::CapturedStmt const*,
clang::VarDecl const*, clang::OpenMPDirectiveKind, llvm::StringRef,
clang::CodeGen::RegionCodeGenTy const&)
.../llvm/tools/clang/lib/CodeGen/CGOpenMPRuntime.cpp:1286:0
#33 0x00000000046891ae
clang::CodeGen::CGOpenMPRuntime::emitParallelOutlinedFunction(clang::OMPExecutableDirective
const&, clang::VarDecl const*, clang::OpenMPDirectiveKind,
clang::CodeGen::RegionCodeGenTy const&)
.../llvm/tools/clang/lib/CodeGen/CGOpenMPRuntime.cpp:1295:0
#34 0x00000000043286af
emitCommonOMPParallelDirective(clang::CodeGen::CodeGenFunction&,
clang::OMPExecutableDirective const&, clang::OpenMPDirectiveKind,
clang::CodeGen::RegionCodeGenTy const&, llvm::function_ref<void
(clang::CodeGen::CodeGenFunction&, clang::OMPExecutableDirective const&,
llvm::SmallVectorImpl<llvm::Value*>&)> const&)
.../llvm/tools/clang/lib/CodeGen/CGStmtOpenMP.cpp:1116:0
#35 0x0000000004331f3d
clang::CodeGen::CodeGenFunction::EmitOMPParallelForDirective(clang::OMPParallelForDirective
const&) .../llvm/tools/clang/lib/CodeGen/CGStmtOpenMP.cpp:2635:0
#36 0x00000000043063fe clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt
const*, llvm::ArrayRef<clang::Attr const*>)
.../llvm/tools/clang/lib/CodeGen/CGStmt.cpp:215:0
#37 0x0000000004306cc2
clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt
const&, bool, clang::CodeGen::AggValueSlot)
.../llvm/tools/clang/lib/CodeGen/CGStmt.cpp:379:0
#38 0x0000000004378507
clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::CodeGen::FunctionArgList&,
clang::Stmt const*) .../llvm/tools/clang/lib/CodeGen/CodeGenFunction.cpp:1122:0
#39 0x0000000004379076
clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl,
llvm::Function*, clang::CodeGen::CGFunctionInfo const&)
.../llvm/tools/clang/lib/CodeGen/CodeGenFunction.cpp:1287:0
#40 0x0000000004396bc1
clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl,
llvm::GlobalValue*) .../llvm/tools/clang/lib/CodeGen/CodeGenModule.cpp:3253:0
#41 0x000000000439230c
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl,
llvm::GlobalValue*) .../llvm/tools/clang/lib/CodeGen/CodeGenModule.cpp:2029:0
#42 0x000000000439148d
clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl)
.../llvm/tools/clang/lib/CodeGen/CodeGenModule.cpp:1806:0
#43 0x000000000439a77a
clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*)
.../llvm/tools/clang/lib/CodeGen/CodeGenModule.cpp:3995:0
#44 0x0000000004da7fec (anonymous
namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef)
.../llvm/tools/clang/lib/CodeGen/ModuleBuilder.cpp:159:0
#45 0x0000000004da1819
clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef)
.../llvm/tools/clang/lib/CodeGen/CodeGenAction.cpp:170:0
#46 0x0000000005a1d4ae clang::ParseAST(clang::Sema&, bool, bool)
.../llvm/tools/clang/lib/Parse/ParseAST.cpp:151:0
#47 0x00000000048b9df0 clang::ASTFrontendAction::ExecuteAction()
.../llvm/tools/clang/lib/Frontend/FrontendAction.cpp:1000:0
#48 0x0000000004da00f6 clang::CodeGenAction::ExecuteAction()
.../llvm/tools/clang/lib/CodeGen/CodeGenAction.cpp:1028:0
#49 0x00000000048b9831 clang::FrontendAction::Execute()
.../llvm/tools/clang/lib/Frontend/FrontendAction.cpp:901:0
#50 0x000000000485bb14
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
.../llvm/tools/clang/lib/Frontend/CompilerInstance.cpp:992:0
#51 0x00000000049f0dc6
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
.../llvm/tools/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:252:0
#52 0x00000000020217fb cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) .../llvm/tools/clang/tools/driver/cc1_main.cpp:221:0
#53 0x0000000002017504 ExecuteCC1Tool(llvm::ArrayRef<char const*>,
llvm::StringRef) .../llvm/tools/clang/tools/driver/driver.cpp:309:0
#54 0x000000000201818d main .../llvm/tools/clang/tools/driver/driver.cpp:388:0
#55 0x00007fb3c9f09b15 __libc_start_main (/lib64/libc.so.6+0x21b15)
#56 0x0000000002014d89 _start (.../bin/clang-6.0+0x2014d89)
Stack dump:
0.      Program arguments: .../bin/clang-6.0 -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -main-file-name
main.cpp -mrelocation-model static -mthread-model posix -mdisable-fp-elim
-fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables
-fuse-init-array -target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb
-coverage-notes-file -resource-dir .../lib/clang/6.0.0 -internal-isystem
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5
-internal-isystem
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5/x86_64-redhat-linux
-internal-isystem
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5/backward
-internal-isystem /usr/local/include -internal-isystem
.../lib/clang/6.0.0/include -internal-externc-isystem /include
-internal-externc-isystem /usr/include -O0 -fdeprecated-macro
-fdebug-compilation-dir -ferror-limit 19 -fmessage-length 271 -fopenmp
-fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option
-fcolor-diagnostics -o main.o -x c++ main.cpp
1.      <eof> parser at end of file
2.      main.cpp:5:6: LLVM IR generation of declaration 'foo'
3.      main.cpp:5:6: Generating code for declaration 'foo'
clang-6.0: error: unable to execute command: Aborted
clang-6.0: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 6.0.0 (trunk 315575)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: .../bin
clang-6.0: note: diagnostic msg: PLEASE submit a bug report to
<a href="http://llvm.org/bugs/">http://llvm.org/bugs/</a> and include the crash backtrace, preprocessed source, and
associated run script.
clang-6.0: note: diagnostic msg:
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-6.0: note: diagnostic msg: /tmp/main-411a1a.cpp
clang-6.0: note: diagnostic msg: /tmp/main-411a1a.sh
clang-6.0: note: diagnostic msg:

********************</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>