[llvm-bugs] [Bug 48076] New: Clang crash when compiling OpenMP target region struct mapping

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Nov 4 08:19:59 PST 2020


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

            Bug ID: 48076
           Summary: Clang crash when compiling OpenMP target region struct
                    mapping
           Product: OpenMP
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Clang Compiler Support
          Assignee: unassignedclangbugs at nondot.org
          Reporter: huberjn at ornl.gov
                CC: llvm-bugs at lists.llvm.org

Created attachment 24136
  --> https://bugs.llvm.org/attachment.cgi?id=24136&action=edit
Small test file showcasing some failing scenarios.

I am experiencing a crash in Clang when compiling a specific target region
mapping. This follows a change made in
https://reviews.llvm.org/rG90a9f97cbda3bef63d9866d300b73b8ccf65c7f5 that caused
this behavior to cause a compiler crash. This code works in Godbolt but fails
on my machine so it may be a local problem. This occurs when compiling the
following code using a clean build of Clang from origin on Nov. 4th 2020:

https://clang.godbolt.org/z/jsoce1

struct S {
    double *p;
};

int main() {
    S s;
#pragma omp target map(s.p)
    { }
}

$ clang++ test.cpp -fopenmp -fopenmp-targets=nvptx64
clang-12: /home2/3n4/llvm/llvm-project/llvm/include/llvm/ADT/SmallVector.h:192:
llvm::SmallVectorTemplateCommon::reference
llvm::SmallVectorTemplateCommon<(anonymous
namespace)::MappableExprsHandler::OpenMPOffloadMappingFlags, void>::front() [T
= (anonymous namespace)::MappableExprsHandler::OpenMPOffloadMappingFlags]:
Assertion `!empty()' failed.
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: /home2/3n4/clang/bin/clang-12 -cc1 -triple
x86_64-unknown-linux-gnu -emit-llvm-bc -emit-llvm-uselists -disable-free
-main-file-name test.cpp -mrelocation-model static -mframe-pointer=all
-fmath-errno -fno-rounding-math -mconstructor-aliases -munwind-tables
-target-cpu x86-64 -tune-cpu generic -fno-split-dwarf-inlining
-debugger-tuning=gdb -resource-dir /home2/3n4/clang/lib/clang/12.0.0
-I/data1/projects/spack/spack/opt/spack/linux-centos8-broadwell/gcc-8.3.1/python-3.7.6-7zpobbl7yu5kkafgzvrl3qa4mrrwrkcv/include/python3.7m
-c-isystem
/data1/projects/spack/spack/opt/spack/linux-centos8-broadwell/gcc-8.3.1/python-3.7.6-7zpobbl7yu5kkafgzvrl3qa4mrrwrkcv/include
-c-isystem
/data1/projects/spack/spack/opt/spack/linux-centos8-broadwell/gcc-8.3.1/cuda-10.1.243-l23v7goqrwkd4wwkihlhpwfjjtzihb6b/include
-cxx-isystem
/data1/projects/spack/spack/opt/spack/linux-centos8-broadwell/gcc-8.3.1/python-3.7.6-7zpobbl7yu5kkafgzvrl3qa4mrrwrkcv/include
-cxx-isystem
/data1/projects/spack/spack/opt/spack/linux-centos8-broadwell/gcc-8.3.1/cuda-10.1.243-l23v7goqrwkd4wwkihlhpwfjjtzihb6b/include
-internal-isystem /home2/3n4/clang/bin/../include/c++/v1 -internal-isystem
/home2/3n4/clang/bin/../include/c++/v1 -internal-isystem /usr/local/include
-internal-isystem /home2/3n4/clang/lib/clang/12.0.0/include
-internal-externc-isystem /include -internal-externc-isystem /usr/include
-internal-isystem /usr/local/include -internal-isystem
/home2/3n4/clang/lib/clang/12.0.0/include -internal-externc-isystem /include
-internal-externc-isystem /usr/include -fdeprecated-macro
-fdebug-compilation-dir /home2/3n4/llvm/llvm-project/build -ferror-limit 19
-fopenmp -fopenmp-cuda-parallel-target-regions -fgnuc-version=4.2.1
-fcxx-exceptions -fexceptions -fcolor-diagnostics -disable-llvm-passes
-fopenmp-targets=nvptx64 -faddrsig -o /tmp/test-77a953.bc -x c++ test.cpp 
1.      <eof> parser at end of file
2.      Per-file LLVM IR generation
3.      test.cpp:5:5: Generating code for declaration 'main'
 #0 0x0000000001b2aeb3 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int)
(/home2/3n4/clang/bin/clang-12+0x1b2aeb3)
 #1 0x0000000001b28c3e llvm::sys::RunSignalHandlers()
(/home2/3n4/clang/bin/clang-12+0x1b28c3e)
 #2 0x0000000001b2b375 SignalHandler(int)
(/home2/3n4/clang/bin/clang-12+0x1b2b375)
 #3 0x00007fb285781dd0 __restore_rt (/lib64/libpthread.so.0+0x12dd0)
 #4 0x00007fb283ee570f raise (/lib64/libc.so.6+0x3770f)
 #5 0x00007fb283ecfb25 abort (/lib64/libc.so.6+0x21b25)
 #6 0x00007fb283ecf9f9 _nl_load_domain.cold.0 (/lib64/libc.so.6+0x219f9)
 #7 0x00007fb283eddcc6 (/lib64/libc.so.6+0x2fcc6)
 #8 0x000000000210c038 (/home2/3n4/clang/bin/clang-12+0x210c038)
 #9 0x000000000211b8d1 (anonymous
namespace)::MappableExprsHandler::generateAllInfo((anonymous
namespace)::MappableExprsHandler::MapCombinedInfoTy&, bool,
llvm::DenseSet<clang::CanonicalDeclPtr<clang::Decl const>,
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::Decl const> > > const&) const
(/home2/3n4/clang/bin/clang-12+0x211b8d1)
#10 0x0000000002117f76
clang::CodeGen::CGOpenMPRuntime::emitTargetCall(clang::CodeGen::CodeGenFunction&,
clang::OMPExecutableDirective const&, llvm::Function*, llvm::Value*,
clang::Expr const*, llvm::PointerIntPair<clang::Expr const*, 2u,
clang::OpenMPDeviceClauseModifier, llvm::PointerLikeTypeTraits<clang::Expr
const*>, llvm::PointerIntPairInfo<clang::Expr const*, 2u,
llvm::PointerLikeTypeTraits<clang::Expr const*> > >,
llvm::function_ref<llvm::Value* (clang::CodeGen::CodeGenFunction&,
clang::OMPLoopDirective
const&)>)::$_30::operator()(clang::CodeGen::CodeGenFunction&,
clang::CodeGen::PrePostActionTy&) const
(/home2/3n4/clang/bin/clang-12+0x2117f76)
#11 0x00000000020f8dc7
clang::CodeGen::CGOpenMPRuntime::emitTargetCall(clang::CodeGen::CodeGenFunction&,
clang::OMPExecutableDirective const&, llvm::Function*, llvm::Value*,
clang::Expr const*, llvm::PointerIntPair<clang::Expr const*, 2u,
clang::OpenMPDeviceClauseModifier, llvm::PointerLikeTypeTraits<clang::Expr
const*>, llvm::PointerIntPairInfo<clang::Expr const*, 2u,
llvm::PointerLikeTypeTraits<clang::Expr const*> > >,
llvm::function_ref<llvm::Value* (clang::CodeGen::CodeGenFunction&,
clang::OMPLoopDirective const&)>) (/home2/3n4/clang/bin/clang-12+0x20f8dc7)
#12 0x0000000001dd440f
emitCommonOMPTargetDirective(clang::CodeGen::CodeGenFunction&,
clang::OMPExecutableDirective const&, clang::CodeGen::RegionCodeGenTy const&)
(/home2/3n4/clang/bin/clang-12+0x1dd440f)
#13 0x0000000001de34d2
clang::CodeGen::CodeGenFunction::EmitOMPTargetDirective(clang::OMPTargetDirective
const&) (/home2/3n4/clang/bin/clang-12+0x1de34d2)
#14 0x0000000001db02d5 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt
const*, llvm::ArrayRef<clang::Attr const*>)
(/home2/3n4/clang/bin/clang-12+0x1db02d5)
#15 0x0000000001dba3b0
clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt
const&, bool, clang::CodeGen::AggValueSlot)
(/home2/3n4/clang/bin/clang-12+0x1dba3b0)
#16 0x0000000001e135d2
clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl,
llvm::Function*, clang::CodeGen::CGFunctionInfo const&)
(/home2/3n4/clang/bin/clang-12+0x1e135d2)
#17 0x0000000001e322de
clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl,
llvm::GlobalValue*) (/home2/3n4/clang/bin/clang-12+0x1e322de)
#18 0x0000000001e2af3c
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl,
llvm::GlobalValue*) (/home2/3n4/clang/bin/clang-12+0x1e2af3c)
#19 0x0000000001e1ea0c clang::CodeGen::CodeGenModule::EmitDeferred()
(/home2/3n4/clang/bin/clang-12+0x1e1ea0c)
#20 0x0000000001e1d419 clang::CodeGen::CodeGenModule::Release()
(/home2/3n4/clang/bin/clang-12+0x1e1d419)
#21 0x000000000297acb4 (anonymous
namespace)::CodeGeneratorImpl::HandleTranslationUnit(clang::ASTContext&)
(/home2/3n4/clang/bin/clang-12+0x297acb4)
#22 0x00000000029774ea
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/home2/3n4/clang/bin/clang-12+0x29774ea)
#23 0x0000000003468b34 clang::ParseAST(clang::Sema&, bool, bool)
(/home2/3n4/clang/bin/clang-12+0x3468b34)
#24 0x000000000233b8a0 clang::FrontendAction::Execute()
(/home2/3n4/clang/bin/clang-12+0x233b8a0)
#25 0x00000000022d0c0a
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/home2/3n4/clang/bin/clang-12+0x22d0c0a)
#26 0x00000000023e71e0
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/home2/3n4/clang/bin/clang-12+0x23e71e0)
#27 0x000000000096d7f0 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/home2/3n4/clang/bin/clang-12+0x96d7f0)
#28 0x000000000096b26c ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&)
(/home2/3n4/clang/bin/clang-12+0x96b26c)
#29 0x000000000096afad main (/home2/3n4/clang/bin/clang-12+0x96afad)
#30 0x00007fb283ed16a3 __libc_start_main (/lib64/libc.so.6+0x236a3)
#31 0x0000000000967dae _start (/home2/3n4/clang/bin/clang-12+0x967dae)
clang-12: error: unable to execute command: Aborted (core dumped)
clang-12: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 12.0.0
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home2/3n4/clang/bin
clang-12: note: diagnostic msg: Error generating preprocessed source(s).

-- 
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/20201104/7b0454e9/attachment-0001.html>


More information about the llvm-bugs mailing list