[llvm-bugs] [Bug 43516] New: Compiler crash with collapse(2) on non-rectangular loop

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Sep 30 14:53:42 PDT 2019


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

            Bug ID: 43516
           Summary: Compiler crash with collapse(2) on non-rectangular
                    loop
           Product: OpenMP
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Clang Compiler Support
          Assignee: unassignedclangbugs at nondot.org
          Reporter: llvm at meinersbur.de
                CC: a.bataev at hotmail.com, llvm-bugs at lists.llvm.org

$ cat collapse.c
#include <stdio.h>
#include <omp.h>

int main() {
  #pragma omp parallel for collapse(2)
  for (int i = 0; i < 4; i+=1)
      for (int j = 0; j < i; j+=1)
         printf("Here is iteration (%d,%d) from %d\n", i, j,
omp_get_thread_num());

  return 0;
}

$ clang --version 
clang version 10.0.0 (trunk 373010) (llvm/trunk 373014)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/meinersbur/build/llvm/release/bin

$ clang collapse.c -fopenmp -c
DeclRefExpr for Decl not entered in LocalDeclMap?
UNREACHABLE executed at
/home/meinersbur/src/llvm/tools/clang/lib/CodeGen/CGExpr.cpp:2623!
Stack dump:
0.      Program arguments: /home/meinersbur/build/llvm/release/bin/clang-8 -cc1
-triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free
-main-file-name collapse.c -mrelocation-model static -mthread-model posix
-mframe-pointer=all -fmath-errno -masm-verbose -mconstructor-aliases
-munwind-tables -fuse-init-array -target-cpu x86-64 -dwarf-column-info
-debugger-tuning=gdb -resource-dir
/home/meinersbur/build/llvm/release/lib/clang/10.0.0 -internal-isystem
/usr/local/include -internal-isystem
/home/meinersbur/build/llvm/release/lib/clang/10.0.0/include
-internal-externc-isystem /usr/include/x86_64-linux-gnu
-internal-externc-isystem /include -internal-externc-isystem /usr/include
-fdebug-compilation-dir /c/Users/meinersbur/build/llvm -ferror-limit 19
-fmessage-length 0 -fopenmp -fobjc-runtime=gcc -fdiagnostics-show-option
-fcolor-diagnostics -faddrsig -o collapse.o -x c collapse.c
1.      <eof> parser at end of file
2.      collapse.c:4:5: LLVM IR generation of declaration 'main'
3.      collapse.c:4:5: Generating code for declaration 'main'
 #0 0x00007f849775664a llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/home/meinersbur/build/llvm/release/bin/clang-8+0x1b5664a)
 #1 0x00007f8497754324 llvm::sys::RunSignalHandlers()
(/home/meinersbur/build/llvm/release/bin/clang-8+0x1b54324)
 #2 0x00007f8497754462 SignalHandler(int)
(/home/meinersbur/build/llvm/release/bin/clang-8+0x1b54462)
 #3 0x00007f84955f2890 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x12890)
 #4 0x00007f849426ee97 raise
/build/glibc-OTsEL5/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:51:0
 #5 0x00007f8494270801 abort /build/glibc-OTsEL5/glibc-2.27/stdlib/abort.c:81:0
 #6 0x00007f84976f244a
(/home/meinersbur/build/llvm/release/bin/clang-8+0x1af244a)
 #7 0x00007f8497bce965
clang::CodeGen::CodeGenFunction::EmitDeclRefLValue(clang::DeclRefExpr const*)
(/home/meinersbur/build/llvm/release/bin/clang-8+0x1fce965)
 #8 0x00007f8497bcd1de clang::CodeGen::CodeGenFunction::EmitLValue(clang::Expr
const*) (/home/meinersbur/build/llvm/release/bin/clang-8+0x1fcd1de)
 #9 0x00007f8497bd224e
clang::CodeGen::CodeGenFunction::EmitCheckedLValue(clang::Expr const*,
clang::CodeGen::CodeGenFunction::TypeCheckKind)
(/home/meinersbur/build/llvm/release/bin/clang-8+0x1fd224e)
#10 0x00007f8497bffc89 (anonymous
namespace)::ScalarExprEmitter::EmitLoadOfLValue(clang::Expr const*)
(/home/meinersbur/build/llvm/release/bin/clang-8+0x1fffc89)
#11 0x00007f8497bfe744 (anonymous
namespace)::ScalarExprEmitter::Visit(clang::Expr*)
(/home/meinersbur/build/llvm/release/bin/clang-8+0x1ffe744)
#12 0x00007f84965840b5 (anonymous
namespace)::ScalarExprEmitter::VisitCastExpr(clang::CastExpr*)
(/home/meinersbur/build/llvm/release/bin/clang-8+0x9840b5)
#13 0x00007f8497bfe488 (anonymous
namespace)::ScalarExprEmitter::Visit(clang::Expr*)
(/home/meinersbur/build/llvm/release/bin/clang-8+0x1ffe488)
#14 0x00007f8497c001bc (anonymous
namespace)::ScalarExprEmitter::EmitBinOps(clang::BinaryOperator const*)
(/home/meinersbur/build/llvm/release/bin/clang-8+0x20001bc)
#15 0x00007f8497c0051b (anonymous
namespace)::ScalarExprEmitter::EmitCompare(clang::BinaryOperator const*,
llvm::CmpInst::Predicate, llvm::CmpInst::Predicate, llvm::CmpInst::Predicate)
(/home/meinersbur/build/llvm/release/bin/clang-8+0x200051b)
#16 0x00007f8497bfd9cb (anonymous
namespace)::ScalarExprEmitter::Visit(clang::Expr*)
(/home/meinersbur/build/llvm/release/bin/clang-8+0x1ffd9cb)
#17 0x00007f84965845ed (anonymous
namespace)::ScalarExprEmitter::VisitCastExpr(clang::CastExpr*)
(/home/meinersbur/build/llvm/release/bin/clang-8+0x9845ed)
#18 0x00007f8497bfe488 (anonymous
namespace)::ScalarExprEmitter::Visit(clang::Expr*)
(/home/meinersbur/build/llvm/release/bin/clang-8+0x1ffe488)
#19 0x00007f84965845a2 (anonymous
namespace)::ScalarExprEmitter::VisitCastExpr(clang::CastExpr*)
(/home/meinersbur/build/llvm/release/bin/clang-8+0x9845a2)
#20 0x00007f8497bfe488 (anonymous
namespace)::ScalarExprEmitter::Visit(clang::Expr*)
(/home/meinersbur/build/llvm/release/bin/clang-8+0x1ffe488)
#21 0x00007f8497bff5f3
clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool)
(/home/meinersbur/build/llvm/release/bin/clang-8+0x1fff5f3)
#22 0x00007f8497bb9775
clang::CodeGen::CodeGenFunction::EvaluateExprAsBool(clang::Expr const*)
(/home/meinersbur/build/llvm/release/bin/clang-8+0x1fb9775)
#23 0x00007f8497a159a6
clang::CodeGen::CodeGenFunction::EmitBranchOnBoolExpr(clang::Expr const*,
llvm::BasicBlock*, llvm::BasicBlock*, unsigned long)
(/home/meinersbur/build/llvm/release/bin/clang-8+0x1e159a6)
#24 0x00007f8497a1604e
clang::CodeGen::CodeGenFunction::EmitBranchOnBoolExpr(clang::Expr const*,
llvm::BasicBlock*, llvm::BasicBlock*, unsigned long)
(/home/meinersbur/build/llvm/release/bin/clang-8+0x1e1604e)
#25 0x00007f84979f0b96 emitPreCond(clang::CodeGen::CodeGenFunction&,
clang::OMPLoopDirective const&, clang::Expr const*, llvm::BasicBlock*,
llvm::BasicBlock*, unsigned long) (.part.1171)
(/home/meinersbur/build/llvm/release/bin/clang-8+0x1df0b96)
#26 0x00007f84979fe730
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&)
(/home/meinersbur/build/llvm/release/bin/clang-8+0x1dfe730)
#27 0x00007f84979ff374 void
clang::CodeGen::RegionCodeGenTy::CallbackFn<clang::CodeGen::CodeGenFunction::EmitOMPParallelForDirective(clang::OMPParallelForDirective
const&)::'lambda'(clang::CodeGen::CodeGenFunction&,
clang::CodeGen::PrePostActionTy&)>(long, clang::CodeGen::CodeGenFunction&,
clang::CodeGen::PrePostActionTy&)
(/home/meinersbur/build/llvm/release/bin/clang-8+0x1dff374)
#28 0x00007f8497c75def
clang::CodeGen::RegionCodeGenTy::operator()(clang::CodeGen::CodeGenFunction&)
const (/home/meinersbur/build/llvm/release/bin/clang-8+0x2075def)
#29 0x00007f8497c75ecf (anonymous
namespace)::CGOpenMPRegionInfo::EmitBody(clang::CodeGen::CodeGenFunction&,
clang::Stmt const*) (/home/meinersbur/build/llvm/release/bin/clang-8+0x2075ecf)
#30 0x00007f8497a06842
clang::CodeGen::CodeGenFunction::GenerateOpenMPCapturedStmtFunction(clang::CapturedStmt
const&) (/home/meinersbur/build/llvm/release/bin/clang-8+0x1e06842)
#31 0x00007f8497caadbc
emitParallelOrTeamsOutlinedFunction(clang::CodeGen::CodeGenModule&,
clang::OMPExecutableDirective const&, clang::CapturedStmt const*,
clang::VarDecl const*, clang::OpenMPDirectiveKind, llvm::StringRef,
clang::CodeGen::RegionCodeGenTy const&)
(/home/meinersbur/build/llvm/release/bin/clang-8+0x20aadbc)
#32 0x00007f8497caaee6
clang::CodeGen::CGOpenMPRuntime::emitParallelOutlinedFunction(clang::OMPExecutableDirective
const&, clang::VarDecl const*, clang::OpenMPDirectiveKind,
clang::CodeGen::RegionCodeGenTy const&)
(/home/meinersbur/build/llvm/release/bin/clang-8+0x20aaee6)
#33 0x00007f84979f43ef
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&)
(/home/meinersbur/build/llvm/release/bin/clang-8+0x1df43ef)
#34 0x00007f84979f4b94
clang::CodeGen::CodeGenFunction::EmitOMPParallelForDirective(clang::OMPParallelForDirective
const&) (/home/meinersbur/build/llvm/release/bin/clang-8+0x1df4b94)
#35 0x00007f84979d490d clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt
const*, llvm::ArrayRef<clang::Attr const*>)
(/home/meinersbur/build/llvm/release/bin/clang-8+0x1dd490d)
#36 0x00007f84979d4d5c
clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt
const&, bool, clang::CodeGen::AggValueSlot)
(/home/meinersbur/build/llvm/release/bin/clang-8+0x1dd4d5c)
#37 0x00007f8497a11297
clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::Stmt const*)
(/home/meinersbur/build/llvm/release/bin/clang-8+0x1e11297)
#38 0x00007f8497a20efd
clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl,
llvm::Function*, clang::CodeGen::CGFunctionInfo const&)
(/home/meinersbur/build/llvm/release/bin/clang-8+0x1e20efd)
#39 0x00007f8497a591ef
clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl,
llvm::GlobalValue*) (/home/meinersbur/build/llvm/release/bin/clang-8+0x1e591ef)
#40 0x00007f8497a56ab5
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl,
llvm::GlobalValue*) (/home/meinersbur/build/llvm/release/bin/clang-8+0x1e56ab5)
#41 0x00007f8497a5719b
clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl)
(/home/meinersbur/build/llvm/release/bin/clang-8+0x1e5719b)
#42 0x00007f8497a5d4d9
clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) (.part.5708)
(/home/meinersbur/build/llvm/release/bin/clang-8+0x1e5d4d9)
#43 0x00007f849822e25d (anonymous
namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef)
(/home/meinersbur/build/llvm/release/bin/clang-8+0x262e25d)
#44 0x00007f8498222a41
clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef)
(/home/meinersbur/build/llvm/release/bin/clang-8+0x2622a41)
#45 0x00007f84982ab814 clang::ParseAST(clang::Sema&, bool, bool)
(/home/meinersbur/build/llvm/release/bin/clang-8+0x26ab814)
#46 0x00007f849822a800 clang::CodeGenAction::ExecuteAction()
(/home/meinersbur/build/llvm/release/bin/clang-8+0x262a800)
#47 0x00007f8497e547d9 clang::FrontendAction::Execute()
(/home/meinersbur/build/llvm/release/bin/clang-8+0x22547d9)
#48 0x00007f8497e178b9
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/home/meinersbur/build/llvm/release/bin/clang-8+0x22178b9)
#49 0x00007f8497f02893
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/home/meinersbur/build/llvm/release/bin/clang-8+0x2302893)
#50 0x00007f84966eaebf cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/home/meinersbur/build/llvm/release/bin/clang-8+0xaeaebf)
#51 0x00007f8496682baa main
(/home/meinersbur/build/llvm/release/bin/clang-8+0xa82baa)
#52 0x00007f8494251b97 __libc_start_main
/build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:344:0
#53 0x00007f84966e663a _start
(/home/meinersbur/build/llvm/release/bin/clang-8+0xae663a)
clang-8: error: unable to execute command: Aborted (core dumped)
clang-8: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 10.0.0 (trunk 373010) (llvm/trunk 373014)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/meinersbur/build/llvm/release/bin
clang-8: 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-8: note: diagnostic msg:
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-8: note: diagnostic msg: /tmp/collapse-6c580f.c
clang-8: note: diagnostic msg: /tmp/collapse-6c580f.sh
clang-8: 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/20190930/05b324eb/attachment-0001.html>


More information about the llvm-bugs mailing list