[llvm-bugs] [Bug 43771] New: 'omp target' directive segfaults Clang with std::decay from libstdc++

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Oct 23 02:54:52 PDT 2019


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

            Bug ID: 43771
           Summary: 'omp target' directive segfaults Clang with std::decay
                    from libstdc++
           Product: OpenMP
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Clang Compiler Support
          Assignee: unassignedclangbugs at nondot.org
          Reporter: hahnjo at hahnjo.de
                CC: llvm-bugs at lists.llvm.org

Created attachment 22707
  --> https://bugs.llvm.org/attachment.cgi?id=22707&action=edit
Crashing code

The attached code crashes the compiler when invoking with:
 $ clang++ -fopenmp -fopenmp-targets=x86_64-unknown-linux-gnu decay.cpp
-stdlib=libstdc++
Stack dump:
0.      Program arguments: <<<install>>>/clang/9.0.0/bin/clang-9 -cc1 -triple
x86_64-unknown-linux-gnu -emit-llvm-bc -emit-llvm-uselists -disable-free
-disable-llvm-verifier -discard-value-names -main-fi
le-name decay.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 -debu
gger-tuning=gdb -resource-dir <<<install>>>/clang/9.0.0/lib64/clang/9.0.0
-I<<<install>>>/clang/9.0.0/include -I<<<install>>/gcc/9.2.0/include -c-isystem
<<<install>>>/clang/9.0.0/include -cxx-isystem
<<<install>>>/clang/9.0.0/include -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/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
<<<install>>>/clang/9.0.0/lib64/clang/9.0.0/include -internal-externc-isystem
/include -internal-externc-isystem /usr/include -internal-isystem
/usr/local/include -internal-isystem
<<<install>>>/clang/9.0.0/lib64/clang/9.0.0/include -internal-externc-isystem
/include -internal-externc-isystem /usr/include -fdeprecated-macro
-fdebug-compilation-dir <<<>>>/tests/OpenMP/target -ferror-limit 19
-fmessage-length 0 -fopenmp -fobjc-runtime=gcc -fcxx-exceptions -fexceptions
-fdiagnostics-show-option -fcolor-diagnostics
-fopenmp-targets=x86_64-unknown-linux-gnu -faddrsig -o /tmp/decay-31da4d.bc -x
c++ decay.cpp 
1.      <eof> parser at end of file
2.      decay.cpp:23:5: LLVM IR generation of declaration 'main'
3.      decay.cpp:23:5: Generating code for declaration 'main'
 #0 0x0000000001fe9384 PrintStackTraceSignalHandler(void*)
(<<<install>>>/clang/9.0.0/bin/clang-9+0x1fe9384)
 #1 0x0000000001fe713e llvm::sys::RunSignalHandlers()
(<<<install>>>/clang/9.0.0/bin/clang-9+0x1fe713e)
 #2 0x0000000001fe9788 SignalHandler(int)
(<<<install>>>/clang/9.0.0/bin/clang-9+0x1fe9788)
 #3 0x00002ad524c145d0 __restore_rt (/lib64/libpthread.so.0+0xf5d0)
 #4 0x0000000002437cd7 (anonymous
namespace)::CGOpenMPInlinedRegionInfo::getContextValue() const
(<<<install>>>/clang/9.0.0/bin/clang-9+0x2437cd7)
 #5 0x00000000023608da
clang::CodeGen::CodeGenFunction::EmitDeclRefLValue(clang::DeclRefExpr const*)
(<<<install>>>/clang/9.0.0/bin/clang-9+0x23608da)
 #6 0x0000000002356257 clang::CodeGen::CodeGenFunction::EmitLValue(clang::Expr
const*) (<<<install>>>/clang/9.0.0/bin/clang-9+0x2356257)
 #7 0x00000000021c1c84
clang::CodeGen::CodeGenFunction::GenerateOpenMPCapturedVars(clang::CapturedStmt
const&, llvm::SmallVectorImpl<llvm::Value*>&)
(<<<install>>>/clang/9.0.0/bin/clang-9+0x21c1c84)
 #8 0x00000000024369e8 (anonymous
namespace)::CGOpenMPRegionInfo::EmitBody(clang::CodeGen::CodeGenFunction&,
clang::Stmt const*) (<<<install>>>/clang/9.0.0/bin/clang-9+0x24369e8)
 #9 0x000000000242f102
clang::CodeGen::CGOpenMPRuntime::emitInlinedDirective(clang::CodeGen::CodeGenFunction&,
clang::OpenMPDirectiveKind, clang::CodeGen::RegionCodeGenTy const&, bool)
(<<<install>>>/clang/9.0.0/bin/clang-9+0x242f102)
#10 0x00000000024301c1
clang::CodeGen::CGOpenMPRuntime::emitTargetCall(clang::CodeGen::CodeGenFunction&,
clang::OMPExecutableDirective const&, llvm::Function*, llvm::Value*,
clang::Expr const*, clang::Expr const*)
(<<<install>>>/clang/9.0.0/bin/clang-9+0x24301c1)
#11 0x00000000021cf4e5
emitCommonOMPTargetDirective(clang::CodeGen::CodeGenFunction&,
clang::OMPExecutableDirective const&, clang::CodeGen::RegionCodeGenTy const&)
(<<<install>>>/clang/9.0.0/bin/clang-9+0x21cf4e5)
#12 0x00000000021d7ec2
clang::CodeGen::CodeGenFunction::EmitOMPTargetDirective(clang::OMPTargetDirective
const&) (<<<install>>>/clang/9.0.0/bin/clang-9+0x21d7ec2)
#13 0x00000000021b2b07 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt
const*, llvm::ArrayRef<clang::Attr const*>)
(<<<install>>>/clang/9.0.0/bin/clang-9+0x21b2b07)
#14 0x00000000021bb730
clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt
const&, bool, clang::CodeGen::AggValueSlot)
(<<<install>>>/clang/9.0.0/bin/clang-9+0x21bb730)
#15 0x00000000021f6c22
clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::Stmt const*)
(<<<install>>>/clang/9.0.0/bin/clang-9+0x21f6c22)
#16 0x00000000021f7772
clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl,
llvm::Function*, clang::CodeGen::CGFunctionInfo const&)
(<<<install>>>/clang/9.0.0/bin/clang-9+0x21f7772)
#17 0x00000000022103ee
clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl,
llvm::GlobalValue*) (<<<install>>>/clang/9.0.0/bin/clang-9+0x22103ee)
#18 0x000000000220a3ef
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl,
llvm::GlobalValue*) (<<<install>>>/clang/9.0.0/bin/clang-9+0x220a3ef)
#19 0x0000000002212d12
clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*)
(<<<install>>>/clang/9.0.0/bin/clang-9+0x2212d12)
#20 0x0000000002b14a9f (anonymous
namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef)
(<<<install>>>/clang/9.0.0/bin/clang-9+0x2b14a9f)
#21 0x0000000002b11b72
clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef)
(<<<install>>>/clang/9.0.0/bin/clang-9+0x2b11b72)
#22 0x00000000032c3854 clang::ParseAST(clang::Sema&, bool, bool)
(<<<install>>>/clang/9.0.0/bin/clang-9+0x32c3854)
#23 0x00000000026020e7 clang::FrontendAction::Execute()
(<<<install>>>/clang/9.0.0/bin/clang-9+0x26020e7)
#24 0x00000000025ac080
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(<<<install>>>/clang/9.0.0/bin/clang-9+0x25ac080)
#25 0x000000000269451e
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(<<<install>>>/clang/9.0.0/bin/clang-9+0x269451e)
#26 0x000000000094d056 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (<<<install>>>/clang/9.0.0/bin/clang-9+0x94d056)
#27 0x000000000094afea main (<<<install>>>/clang/9.0.0/bin/clang-9+0x94afea)
#28 0x00002ad5260a9495 __libc_start_main (/lib64/libc.so.6+0x22495)
#29 0x000000000094810d _start (<<<install>>>/clang/9.0.0/bin/clang-9+0x94810d)
clang-9: error: unable to execute command: Segmentation fault (core dumped)
clang-9: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 9.0.0 (tags/RELEASE_900/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: <<<install>>>/clang/9.0.0/bin
clang-9: note: diagnostic msg: PLEASE submit a bug report to
https://bugs.llvm.org/ and include the crash backtrace, preprocessed source,
and associated run script.
clang-9: note: diagnostic msg: Error generating preprocessed source(s).

It works fine with libc++ though.

-- 
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/20191023/975699cb/attachment-0001.html>


More information about the llvm-bugs mailing list