Issue 93378
Summary [Flang] llvm-project/flang/lib/Lower/Bridge.cpp:2027: void (anonymous namespace)::FirConverter::genFIRIncrementLoopBegin((anonymous namespace)::IncrementLoopNestInfo &): Assertion `latchBlock && "missing masked concurrent loop latch block"' failed.
Labels flang
Assignees
Reporter k-arrows
    Crash itself is reproducible on Godbolt:
https://godbolt.org/z/9MdKzjeYY

Reproducer:
```console
integer :: i

do 30 concurrent(i=10:0:-2, i/=5)
30 continue
goto 30
end
```

With assertion-enabled flang-new, compiling the reproducer resulted in the following assertion failure:
```txt
llvm-project/flang/lib/Lower/Bridge.cpp:2027: void (anonymous namespace)::FirConverter::genFIRIncrementLoopBegin((anonymous namespace)::IncrementLoopNestInfo &): Assertion `latchBlock && "missing masked concurrent loop latch block"' failed.
``` 

Stack dump from Godbolt:
```console
/app/example.f90:5:1: warning: branch into loop body from outside
  goto 30
  ^^^^^^^
/app/example.f90:3:1: the loop branched into
  do 30 concurrent(i=10:0:-2, i/=5)
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.	Program arguments: /opt/compiler-explorer/clang-llvmflang-trunk-20240525/bin/flang-new -fc1 -triple x86_64-unknown-linux-gnu -S -mrelocation-model pic -pic-level 2 -pic-is-pie -target-cpu x86-64 -mllvm -x86-asm-syntax=intel -resource-dir /opt/compiler-explorer/clang-llvmflang-trunk-20240525/bin/.. -mframe-pointer=all -o /app/output.s -x f95-cpp-input /app/example.f90
 #0 0x0000000003831598 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-llvmflang-trunk-20240525/bin/flang-new+0x3831598)
 #1 0x000000000382ef0c SignalHandler(int) Signals.cpp:0:0
 #2 0x000076330fe42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #3 0x0000000007f30b1f mlir::Operation::create(mlir::Location, mlir::OperationName, mlir::TypeRange, mlir::ValueRange, mlir::DictionaryAttr, mlir::OpaqueProperties, mlir::BlockRange, unsigned int) (/opt/compiler-explorer/clang-llvmflang-trunk-20240525/bin/flang-new+0x7f30b1f)
 #4 0x0000000007f30e60 mlir::Operation::create(mlir::Location, mlir::OperationName, mlir::TypeRange, mlir::ValueRange, mlir::NamedAttrList&&, mlir::OpaqueProperties, mlir::BlockRange, mlir::RegionRange) (/opt/compiler-explorer/clang-llvmflang-trunk-20240525/bin/flang-new+0x7f30e60)
 #5 0x0000000007f31387 mlir::Operation::create(mlir::OperationState const&) (/opt/compiler-explorer/clang-llvmflang-trunk-20240525/bin/flang-new+0x7f31387)
 #6 0x0000000007e9590f mlir::OpBuilder::create(mlir::OperationState const&) (/opt/compiler-explorer/clang-llvmflang-trunk-20240525/bin/flang-new+0x7e9590f)
 #7 0x0000000003c107e4 mlir::cf::CondBranchOp mlir::OpBuilder::create<mlir::cf::CondBranchOp, mlir::Value&, mlir::Block*&, std::nullopt_t const&, mlir::Block*&, std::nullopt_t const&>(mlir::Location, mlir::Value&, mlir::Block*&, std::nullopt_t const&, mlir::Block*&, std::nullopt_t const&) (/opt/compiler-explorer/clang-llvmflang-trunk-20240525/bin/flang-new+0x3c107e4)
 #8 0x0000000003c1092d (anonymous namespace)::FirConverter::genConditionalBranch(mlir::Value, mlir::Block*, mlir::Block*) Bridge.cpp:0:0
 #9 0x0000000003c31d4d (anonymous namespace)::FirConverter::genFIRIncrementLoopBegin(llvm::SmallVector<(anonymous namespace)::IncrementLoopInfo, 8u>&) Bridge.cpp:0:0
#10 0x0000000003c465e0 (anonymous namespace)::FirConverter::genFIR(Fortran::parser::DoConstruct const&) Bridge.cpp:0:0
#11 0x0000000003c2ef4c (anonymous namespace)::FirConverter::lowerFunc(Fortran::lower::pft::FunctionLikeUnit&) Bridge.cpp:0:0
#12 0x0000000003c20c40 Fortran::lower::LoweringBridge::lower(Fortran::parser::Program const&, Fortran::semantics::SemanticsContext const&) (/opt/compiler-explorer/clang-llvmflang-trunk-20240525/bin/flang-new+0x3c20c40)
#13 0x0000000003bb4856 Fortran::frontend::CodeGenAction::beginSourceFileAction() (/opt/compiler-explorer/clang-llvmflang-trunk-20240525/bin/flang-new+0x3bb4856)
#14 0x0000000003881f85 Fortran::frontend::FrontendAction::beginSourceFile(Fortran::frontend::CompilerInstance&, Fortran::frontend::FrontendInputFile const&) (/opt/compiler-explorer/clang-llvmflang-trunk-20240525/bin/flang-new+0x3881f85)
#15 0x00000000038710d7 Fortran::frontend::CompilerInstance::executeAction(Fortran::frontend::FrontendAction&) (/opt/compiler-explorer/clang-llvmflang-trunk-20240525/bin/flang-new+0x38710d7)
#16 0x0000000003887f4b Fortran::frontend::executeCompilerInvocation(Fortran::frontend::CompilerInstance*) (/opt/compiler-explorer/clang-llvmflang-trunk-20240525/bin/flang-new+0x3887f4b)
#17 0x0000000001fc0fd8 fc1_main(llvm::ArrayRef<char const*>, char const*) (/opt/compiler-explorer/clang-llvmflang-trunk-20240525/bin/flang-new+0x1fc0fd8)
#18 0x0000000001eaf904 main (/opt/compiler-explorer/clang-llvmflang-trunk-20240525/bin/flang-new+0x1eaf904)
#19 0x000076330fe29d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#20 0x000076330fe29e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#21 0x0000000001fbfe9e _start (/opt/compiler-explorer/clang-llvmflang-trunk-20240525/bin/flang-new+0x1fbfe9e)
flang-new: error: unable to execute command: Segmentation fault (core dumped)
flang-new: error: flang frontend command failed due to signal (use -v to see invocation)
flang-new version 19.0.0git (https://github.com/llvm/llvm-project.git 9b31cc71d66064dfaf2afabf4a835211321bb4a0)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/compiler-explorer/clang-llvmflang-trunk-20240525/bin
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to