[llvm-bugs] [Bug 50699] New: [OpenMP] "DeclRefExpr for Decl not entered in LocalDeclMap?"

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Jun 13 13:04:37 PDT 2021


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

            Bug ID: 50699
           Summary: [OpenMP] "DeclRefExpr for Decl not entered in
                    LocalDeclMap?"
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: OpenMP
          Assignee: unassignedclangbugs at nondot.org
          Reporter: lebedev.ri at gmail.com
                CC: llvm-bugs at lists.llvm.org

Reduced from darktable's gradient.c
I'm not sure when this problem was introduced,
i think it was hidden by the `complex` handling bug.

$ cat input.c
a;
b() {
  float *c;
#pragma omp parallel for simd aligned(c)
  for (int d = 3; d < a; d++)
    ;
}
$ /builddirs/llvm-project/build-Clang12/bin/clang input.c -fopenmp
input.c:1:1: warning: type specifier missing, defaults to 'int'
[-Wimplicit-int]
a;
^
input.c:2:1: warning: type specifier missing, defaults to 'int'
[-Wimplicit-int]
b() {
^
input.c:7:1: warning: non-void function does not return a value [-Wreturn-type]
}
^
DeclRefExpr for Decl not entered in LocalDeclMap?
UNREACHABLE executed at
/repositories/llvm-project/clang/lib/CodeGen/CGExpr.cpp:2794!
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash
backtrace, preprocessed source, and associated run script.
Stack dump:
0.      Program arguments: /builddirs/llvm-project/build-Clang12/bin/clang-13
-cc1 -triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all
--mrelax-relocations -disable-free -main-file-name input.c -mrelocation-model
static -mframe-pointer=all -fmath-errno -fno-rounding-math
-mconstructor-aliases -munwind-tables -target-cpu x86-64 -tune-cpu generic
-debugger-tuning=gdb -fcoverage-compilation-dir=/home/lebedevri/CREDUCE
-resource-dir /builddirs/llvm-project/build-Clang12/lib/clang/13.0.0
-internal-isystem
/builddirs/llvm-project/build-Clang12/lib/clang/13.0.0/include
-internal-isystem /usr/local/include -internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/10/../../../../x86_64-linux-gnu/include
-internal-externc-isystem /usr/include/x86_64-linux-gnu
-internal-externc-isystem /include -internal-externc-isystem /usr/include
-fdebug-compilation-dir=/home/lebedevri/CREDUCE -ferror-limit 19 -fopenmp
-fopenmp-cuda-parallel-target-regions -fgnuc-version=4.2.1 -fcolor-diagnostics
-faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/input-9501af.o -x c input.c
1.      <eof> parser at end of file
2.      Per-file LLVM IR generation
3.      input.c:2:1: Generating code for declaration 'b'
 #0 0x00007f86dd839183 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int)
/repositories/llvm-project/llvm/lib/Support/Unix/Signals.inc:565:13
 #1 0x00007f86dd836d50 llvm::sys::RunSignalHandlers()
/repositories/llvm-project/llvm/lib/Support/Signals.cpp:77:18
 #2 0x00007f86dd83968f SignalHandler(int)
/repositories/llvm-project/llvm/lib/Support/Unix/Signals.inc:407:1
 #3 0x00007f86e1693140 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x14140)
 #4 0x00007f86dd151ce1 raise ./signal/../sysdeps/unix/sysv/linux/raise.c:51:1
 #5 0x00007f86dd13b537 abort ./stdlib/abort.c:81:7
 #6 0x00007f86dd764a31
(/builddirs/llvm-project/build-Clang12/bin/../lib/libLLVMSupport.so.13git+0x15ca31)
 #7 0x00007f86e132e1d3
clang::CodeGen::CodeGenFunction::EmitDeclRefLValue(clang::DeclRefExpr const*)
/repositories/llvm-project/clang/lib/CodeGen/CGExpr.cpp:0:0
 #8 0x00007f86e1321539 clang::CodeGen::CodeGenFunction::EmitLValue(clang::Expr
const*) /repositories/llvm-project/clang/lib/CodeGen/CGExpr.cpp:1317:12
 #9 0x00007f86e132aec4
clang::CodeGen::CodeGenFunction::EmitCheckedLValue(clang::Expr const*,
clang::CodeGen::CodeGenFunction::TypeCheckKind)
/repositories/llvm-project/clang/lib/CodeGen/CGExpr.cpp:1254:8
#10 0x00007f86e1381873 clang::StmtVisitorBase<std::add_pointer, (anonymous
namespace)::ScalarExprEmitter, llvm::Value*>::Visit(clang::Stmt*)
/repositories/llvm-project/clang/include/clang/AST/APValue.h:0:7
#11 0x00007f86e13719e6 (anonymous
namespace)::ScalarExprEmitter::Visit(clang::Expr*)
/repositories/llvm-project/clang/lib/CodeGen/CGExprScalar.cpp:0:52
#12 0x00007f86e13719e6
clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool)
/repositories/llvm-project/clang/lib/CodeGen/CGExprScalar.cpp:4819:8
#13 0x00007f86e14c69b4 clang::CodeGen::CodeGenFunction::getLLVMContext()
/repositories/llvm-project/clang/lib/CodeGen/CodeGenFunction.h:1968:48
#14 0x00007f86e14c69b4 emitAlignedClause(clang::CodeGen::CodeGenFunction&,
clang::OMPExecutableDirective const&)
/repositories/llvm-project/clang/lib/CodeGen/CGStmtOpenMP.cpp:2197:40
#15 0x00007f86e14c42d6
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&)
/repositories/llvm-project/clang/lib/CodeGen/CGStmtOpenMP.cpp:3120:23
#16 0x00007f86e14def1a
emitWorksharingDirective(clang::CodeGen::CodeGenFunction&,
clang::OMPLoopDirective const&, bool)
/repositories/llvm-project/clang/lib/CodeGen/CGStmtOpenMP.cpp:3586:21
#17 0x00007f86e140e7db
clang::CodeGen::CodeGenFunction::RunCleanupsScope::ForceCleanup(std::initializer_list<llvm::Value**>)
/repositories/llvm-project/clang/lib/CodeGen/CodeGenFunction.h:881:28
#18 0x00007f86e140e7db
clang::CodeGen::CodeGenFunction::RunCleanupsScope::~RunCleanupsScope()
/repositories/llvm-project/clang/lib/CodeGen/CodeGenFunction.h:865:9
#19 0x00007f86e140e7db
clang::CodeGen::RegionCodeGenTy::operator()(clang::CodeGen::CodeGenFunction&)
const /repositories/llvm-project/clang/lib/CodeGen/CGOpenMPRuntime.cpp:603:1
#20 0x00007f86e144c7fb clang::CodeGen::EHScopeStack::empty() const
/repositories/llvm-project/clang/lib/CodeGen/EHScopeStack.h:350:31
#21 0x00007f86e144c7fb clang::CodeGen::EHScopeStack::popTerminate()
/repositories/llvm-project/clang/lib/CodeGen/CGCleanup.h:568:3
#22 0x00007f86e144c7fb (anonymous
namespace)::CGOpenMPRegionInfo::EmitBody(clang::CodeGen::CodeGenFunction&,
clang::Stmt const*)
/repositories/llvm-project/clang/lib/CodeGen/CGOpenMPRuntime.cpp:1054:15
#23 0x00007f86e14b17f6
clang::CodeGen::CodeGenFunction::GenerateOpenMPCapturedStmtFunction(clang::CapturedStmt
const&, clang::SourceLocation)
/repositories/llvm-project/clang/lib/CodeGen/CGStmtOpenMP.cpp:0:21
#24 0x00007f86e14158e6
emitParallelOrTeamsOutlinedFunction(clang::CodeGen::CodeGenModule&,
clang::OMPExecutableDirective const&, clang::CapturedStmt const*,
clang::VarDecl const*, llvm::omp::Directive, llvm::StringRef,
clang::CodeGen::RegionCodeGenTy const&)
/repositories/llvm-project/clang/lib/CodeGen/CGOpenMPRuntime.cpp:0:14
#25 0x00007f86e1415656
clang::CodeGen::CGOpenMPRuntime::emitParallelOutlinedFunction(clang::OMPExecutableDirective
const&, clang::VarDecl const*, llvm::omp::Directive,
clang::CodeGen::RegionCodeGenTy const&)
/repositories/llvm-project/clang/lib/CodeGen/CGOpenMPRuntime.cpp:1290:10
#26 0x00007f86e14bb54a clang::OMPExecutableDirective::clauses() const
/repositories/llvm-project/clang/include/clang/AST/StmtOpenMP.h:573:10
#27 0x00007f86e14bb54a clang::OMPNumThreadsClause const*
clang::OMPExecutableDirective::getSingleClause<clang::OMPNumThreadsClause>()
const /repositories/llvm-project/clang/include/clang/AST/StmtOpenMP.h:476:44
#28 0x00007f86e14bb54a
emitCommonOMPParallelDirective(clang::CodeGen::CodeGenFunction&,
clang::OMPExecutableDirective const&, llvm::omp::Directive,
clang::CodeGen::RegionCodeGenTy const&, llvm::function_ref<void
(clang::CodeGen::CodeGenFunction&, clang::OMPExecutableDirective const&,
llvm::SmallVectorImpl<llvm::Value*>&)> const&)
/repositories/llvm-project/clang/lib/CodeGen/CGStmtOpenMP.cpp:1557:40
#29 0x00007f86e14c9b60
clang::CodeGen::CodeGenFunction::EmitOMPParallelForSimdDirective(clang::OMPParallelForSimdDirective
const&) /repositories/llvm-project/clang/lib/CodeGen/CGStmtOpenMP.cpp:0:5
#30 0x00007f86e149eea1 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt
const*, llvm::ArrayRef<clang::Attr const*>)
/repositories/llvm-project/clang/lib/CodeGen/CGStmt.cpp:0:5
#31 0x00007f86e14aa8d0
clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt
const&, bool, clang::CodeGen::AggValueSlot)
/repositories/llvm-project/clang/lib/CodeGen/CGStmt.cpp:461:22
#32 0x00007f86e1511ec6
clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::Stmt const*)
/repositories/llvm-project/clang/lib/CodeGen/CodeGenFunction.cpp:0:5
#33 0x00007f86e15129e9 clang::CodeGen::CodeGenFunction::getLangOpts() const
/repositories/llvm-project/clang/lib/CodeGen/CodeGenFunction.h:1938:51
#34 0x00007f86e15129e9
clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl,
llvm::Function*, clang::CodeGen::CGFunctionInfo const&)
/repositories/llvm-project/clang/lib/CodeGen/CodeGenFunction.cpp:1378:7
#35 0x00007f86e1534e7e
clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl,
llvm::GlobalValue*)
/repositories/llvm-project/clang/lib/CodeGen/CodeGenModule.cpp:0:26
#36 0x00007f86e152c961
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl,
llvm::GlobalValue*)
/repositories/llvm-project/clang/lib/CodeGen/CodeGenModule.cpp:0:12
#37 0x00007f86e152045f __gnu_cxx::__normal_iterator<clang::CXXRecordDecl const*
const*, std::vector<clang::CXXRecordDecl const*,
std::allocator<clang::CXXRecordDecl const*> >
>::__normal_iterator(clang::CXXRecordDecl const* const* const&)
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/stl_iterator.h:979:20
#38 0x00007f86e152045f std::vector<clang::CXXRecordDecl const*,
std::allocator<clang::CXXRecordDecl const*> >::begin() const
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/stl_vector.h:821:16
#39 0x00007f86e152045f std::vector<clang::CXXRecordDecl const*,
std::allocator<clang::CXXRecordDecl const*> >::empty() const
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/stl_vector.h:1008:16
#40 0x00007f86e152045f clang::CodeGen::CodeGenModule::EmitDeferred()
/repositories/llvm-project/clang/lib/CodeGen/CodeGenModule.cpp:2440:26
#41 0x00007f86e151edc9 clang::CodeGen::CodeGenModule::Release()
/repositories/llvm-project/clang/lib/CodeGen/CodeGenModule.cpp:478:3
#42 0x00007f86e15c9544 (anonymous
namespace)::CodeGeneratorImpl::HandleTranslationUnit(clang::ASTContext&)
/repositories/llvm-project/clang/lib/CodeGen/ModuleBuilder.cpp:271:11
#43 0x00007f86e150442d
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
/repositories/llvm-project/clang/lib/CodeGen/CodeGenAction.cpp:291:13
#44 0x00007f86dad63f73
__gnu_cxx::__normal_iterator<std::unique_ptr<clang::TemplateInstantiationCallback,
std::default_delete<clang::TemplateInstantiationCallback> >*,
std::vector<std::unique_ptr<clang::TemplateInstantiationCallback,
std::default_delete<clang::TemplateInstantiationCallback> >,
std::allocator<std::unique_ptr<clang::TemplateInstantiationCallback,
std::default_delete<clang::TemplateInstantiationCallback> > > >
>::__normal_iterator(std::unique_ptr<clang::TemplateInstantiationCallback,
std::default_delete<clang::TemplateInstantiationCallback> >* const&)
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/stl_iterator.h:979:20
#45 0x00007f86dad63f73
std::vector<std::unique_ptr<clang::TemplateInstantiationCallback,
std::default_delete<clang::TemplateInstantiationCallback> >,
std::allocator<std::unique_ptr<clang::TemplateInstantiationCallback,
std::default_delete<clang::TemplateInstantiationCallback> > > >::begin()
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/stl_vector.h:812:16
#46 0x00007f86dad63f73 void
clang::finalize<std::vector<std::unique_ptr<clang::TemplateInstantiationCallback,
std::default_delete<clang::TemplateInstantiationCallback> >,
std::allocator<std::unique_ptr<clang::TemplateInstantiationCallback,
std::default_delete<clang::TemplateInstantiationCallback> > > >
>(std::vector<std::unique_ptr<clang::TemplateInstantiationCallback,
std::default_delete<clang::TemplateInstantiationCallback> >,
std::allocator<std::unique_ptr<clang::TemplateInstantiationCallback,
std::default_delete<clang::TemplateInstantiationCallback> > > >&, clang::Sema
const&)
/repositories/llvm-project/clang/include/clang/Sema/TemplateInstCallback.h:54:16
#47 0x00007f86dad63f73 clang::ParseAST(clang::Sema&, bool, bool)
/repositories/llvm-project/clang/lib/Parse/ParseAST.cpp:178:3
#48 0x00007f86df90acef clang::FrontendAction::Execute()
/repositories/llvm-project/clang/lib/Frontend/FrontendAction.cpp:955:10
#49 0x00007f86df86ba1f llvm::Error::getPtr() const
/repositories/llvm-project/llvm/include/llvm/Support/Error.h:274:42
#50 0x00007f86df86ba1f llvm::Error::operator bool()
/repositories/llvm-project/llvm/include/llvm/Support/Error.h:236:16
#51 0x00007f86df86ba1f
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
/repositories/llvm-project/clang/lib/Frontend/CompilerInstance.cpp:977:23
#52 0x00007f86e1678dc4 std::__shared_ptr<clang::CompilerInvocation,
(__gnu_cxx::_Lock_policy)2>::get() const
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/shared_ptr_base.h:1325:16
#53 0x00007f86e1678dc4 std::__shared_ptr_access<clang::CompilerInvocation,
(__gnu_cxx::_Lock_policy)2, false, false>::_M_get() const
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/shared_ptr_base.h:1024:66
#54 0x00007f86e1678dc4 std::__shared_ptr_access<clang::CompilerInvocation,
(__gnu_cxx::_Lock_policy)2, false, false>::operator->() const
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/shared_ptr_base.h:1018:9
#55 0x00007f86e1678dc4 clang::CompilerInstance::getFrontendOpts()
/repositories/llvm-project/clang/include/clang/Frontend/CompilerInstance.h:282:12
#56 0x00007f86e1678dc4
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
/repositories/llvm-project/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:279:14
#57 0x0000000000217f98 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) /repositories/llvm-project/clang/tools/driver/cc1_main.cpp:0:0
#58 0x0000000000215ccf ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&)
/repositories/llvm-project/clang/tools/driver/driver.cpp:0:12
#59 0x000000000021540a main
/repositories/llvm-project/clang/tools/driver/driver.cpp:0:12
#60 0x00007f86dd13cd0a __libc_start_main ./csu/../csu/libc-start.c:308:16
#61 0x0000000000211a0a _start
(/builddirs/llvm-project/build-Clang12/bin/clang-13+0x211a0a)
clang-13: error: unable to execute command: Aborted
clang-13: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 13.0.0 (git at github.com:LebedevRI/llvm-project.git
3dc727e81b92f53533da1c617584f466a7dfb9cc)

-- 
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/20210613/ce13815c/attachment-0001.html>


More information about the llvm-bugs mailing list