[llvm-bugs] [Bug 34926] New: [openmp] clang crashes due to segfault in ADT/APInt.h

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Oct 12 07:14:46 PDT 2017


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

            Bug ID: 34926
           Summary: [openmp] clang crashes due to segfault in ADT/APInt.h
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: sergey.nesterov at intel.com
                CC: llvm-bugs at lists.llvm.org

=======================main.c=======================
void foo(short x[1]) {
    #pragma omp parallel for reduction(+:x[:])
        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.c
#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 0x00007f4b81d56100 __restore_rt (/lib64/libpthread.so.0+0xf100)
#5 0x0000000002044eb6 llvm::APInt::APInt(llvm::APInt const&)
.../llvm/include/llvm/ADT/APInt.h:315:0
#6 0x00000000045d9599
clang::CodeGen::CodeGenFunction::EmitOMPArraySectionExpr(clang::OMPArraySectionExpr
const*, bool) .../llvm/tools/clang/lib/CodeGen/CGExpr.cpp:3432:0
#7 0x0000000004684d72
clang::CodeGen::ReductionCodeGen::emitSharedLValueUB(clang::CodeGen::CodeGenFunction&,
clang::Expr const*) .../llvm/tools/clang/lib/CodeGen/CGOpenMPRuntime.cpp:871:0
#8 0x00000000046852bd
clang::CodeGen::ReductionCodeGen::emitSharedLValue(clang::CodeGen::CodeGenFunction&,
unsigned int) .../llvm/tools/clang/lib/CodeGen/CGOpenMPRuntime.cpp:907:0
#9 0x0000000004327885
clang::CodeGen::CodeGenFunction::EmitOMPReductionClauseInit(clang::OMPExecutableDirective
const&, clang::CodeGen::CodeGenFunction::OMPPrivateScope&)
.../llvm/tools/clang/lib/CodeGen/CGStmtOpenMP.cpp:979:0
#10 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
#11 0x0000000004331ebc operator()
.../llvm/tools/clang/lib/CodeGen/CGStmtOpenMP.cpp:2632:0
#12 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)
#13 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
#14 0x0000000004683e77
clang::CodeGen::RegionCodeGenTy::operator()(clang::CodeGen::CodeGenFunction&)
const .../llvm/tools/clang/lib/CodeGen/CGOpenMPRuntime.cpp:710:0
#15 0x0000000004687e1a (anonymous
namespace)::CGOpenMPRegionInfo::EmitBody(clang::CodeGen::CodeGenFunction&,
clang::Stmt const*) .../llvm/tools/clang/lib/CodeGen/CGOpenMPRuntime.cpp:1129:0
#16 0x0000000004323fcf
clang::CodeGen::CodeGenFunction::GenerateOpenMPCapturedStmtFunction(clang::CapturedStmt
const&) .../llvm/tools/clang/lib/CodeGen/CGStmtOpenMP.cpp:485:0
#17 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
#18 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
#19 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
#20 0x0000000004331f3d
clang::CodeGen::CodeGenFunction::EmitOMPParallelForDirective(clang::OMPParallelForDirective
const&) .../llvm/tools/clang/lib/CodeGen/CGStmtOpenMP.cpp:2635:0
#21 0x00000000043063fe clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt
const*, llvm::ArrayRef<clang::Attr const*>)
.../llvm/tools/clang/lib/CodeGen/CGStmt.cpp:215:0
#22 0x0000000004306cc2
clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt
const&, bool, clang::CodeGen::AggValueSlot)
.../llvm/tools/clang/lib/CodeGen/CGStmt.cpp:379:0
#23 0x0000000004378507
clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::CodeGen::FunctionArgList&,
clang::Stmt const*) .../llvm/tools/clang/lib/CodeGen/CodeGenFunction.cpp:1122:0
#24 0x0000000004379076
clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl,
llvm::Function*, clang::CodeGen::CGFunctionInfo const&)
.../llvm/tools/clang/lib/CodeGen/CodeGenFunction.cpp:1287:0
#25 0x0000000004396bc1
clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl,
llvm::GlobalValue*) .../llvm/tools/clang/lib/CodeGen/CodeGenModule.cpp:3253:0
#26 0x000000000439230c
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl,
llvm::GlobalValue*) .../llvm/tools/clang/lib/CodeGen/CodeGenModule.cpp:2029:0
#27 0x000000000439148d
clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl)
.../llvm/tools/clang/lib/CodeGen/CodeGenModule.cpp:1806:0
#28 0x000000000439a77a
clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*)
.../llvm/tools/clang/lib/CodeGen/CodeGenModule.cpp:3995:0
#29 0x0000000004da7fec (anonymous
namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef)
.../llvm/tools/clang/lib/CodeGen/ModuleBuilder.cpp:159:0
#30 0x0000000004da1819
clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef)
.../llvm/tools/clang/lib/CodeGen/CodeGenAction.cpp:170:0
#31 0x0000000005a1d4ae clang::ParseAST(clang::Sema&, bool, bool)
.../llvm/tools/clang/lib/Parse/ParseAST.cpp:151:0
#32 0x00000000048b9df0 clang::ASTFrontendAction::ExecuteAction()
.../llvm/tools/clang/lib/Frontend/FrontendAction.cpp:1000:0
#33 0x0000000004da00f6 clang::CodeGenAction::ExecuteAction()
.../llvm/tools/clang/lib/CodeGen/CodeGenAction.cpp:1028:0
#34 0x00000000048b9831 clang::FrontendAction::Execute()
.../llvm/tools/clang/lib/Frontend/FrontendAction.cpp:901:0
#35 0x000000000485bb14
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
.../llvm/tools/clang/lib/Frontend/CompilerInstance.cpp:992:0
#36 0x00000000049f0dc6
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
.../llvm/tools/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:252:0
#37 0x00000000020217fb cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) .../llvm/tools/clang/tools/driver/cc1_main.cpp:221:0
#38 0x0000000002017504 ExecuteCC1Tool(llvm::ArrayRef<char const*>,
llvm::StringRef) .../llvm/tools/clang/tools/driver/driver.cpp:309:0
#39 0x000000000201818d main .../llvm/tools/clang/tools/driver/driver.cpp:388:0
#40 0x00007f4b8093ab15 __libc_start_main (/lib64/libc.so.6+0x21b15)
#41 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.c -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 .../main.gcno -resource-dir .../lib/clang/6.0.0
-internal-isystem /usr/local/include -internal-isystem
.../lib/clang/6.0.0/include -internal-externc-isystem /include
-internal-externc-isystem /usr/include -O0 -fdebug-compilation-dir ...
-ferror-limit 19 -fmessage-length 271 -fopenmp -fobjc-runtime=gcc
-fdiagnostics-show-option -fcolor-diagnostics -o main.o -x c main.c
1.      <eof> parser at end of file
2.      main.c:1:6: LLVM IR generation of declaration 'foo'
3.      main.c:1:6: Generating code for declaration 'foo'
clang-6.0: error: unable to execute command: Segmentation fault
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
http://llvm.org/bugs/ 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-a47233.c
clang-6.0: note: diagnostic msg: /tmp/main-a47233.sh
clang-6.0: note: diagnostic msg:

********************

-- 
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/20171012/dfe15d18/attachment.html>


More information about the llvm-bugs mailing list