Issue 91053
Summary [Flang] fatal internal error: CHECK(kind_ > 0) failed at /root/llvm-project/flang/include/flang/Evaluate/type.h(149)
Labels flang
Assignees
Reporter k-arrows
    Reproducible on Godbolt:
https://godbolt.org/z/Pqsv67rdW

Reproducer:
```console
$ cat test.f90
type(*) :: i
integer :: j(1)
j = (/(i, i = 1,1)/)
end
```

Stack dump:
```console
fatal internal error: CHECK(kind_ > 0) failed at /root/llvm-project/flang/include/flang/Evaluate/type.h(149)
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-20240504/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-20240504/lib/clang/19 -mframe-pointer=all -o /app/output.s -x f95-cpp-input /app/example.f90
 #0 0x000000000376d358 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-llvmflang-trunk-20240504/bin/flang-new+0x376d358)
 #1 0x000000000376accc SignalHandler(int) Signals.cpp:0:0
 #2 0x00007f0503242520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #3 0x00007f05032969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #4 0x00007f0503242476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #5 0x00007f05032287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #6 0x0000000004cde5d9 (/opt/compiler-explorer/clang-llvmflang-trunk-20240504/bin/flang-new+0x4cde5d9)
 #7 0x0000000003f998e7 (/opt/compiler-explorer/clang-llvmflang-trunk-20240504/bin/flang-new+0x3f998e7)
 #8 0x0000000003ffeeb7 (/opt/compiler-explorer/clang-llvmflang-trunk-20240504/bin/flang-new+0x3ffeeb7)
 #9 0x0000000003ff5474 Fortran::evaluate::ExpressionAnalyzer::Analyze(Fortran::parser::ArrayConstructor const&) (/opt/compiler-explorer/clang-llvmflang-trunk-20240504/bin/flang-new+0x3ff5474)
#10 0x0000000003ff58ed std::optional<Fortran::evaluate::Expr<Fortran::evaluate::SomeType>> Fortran::common::log2visit::Log2VisitHelper<0ul, 7ul, std::optional<Fortran::evaluate::Expr<Fortran::evaluate::SomeType>>, std::optional<Fortran::evaluate::Expr<Fortran::evaluate::SomeType>> Fortran::evaluate::ExpressionAnalyzer::Analyze<Fortran::common::Indirection<Fortran::parser::CharLiteralConstantSubstring, false>, Fortran::parser::LiteralConstant, Fortran::common::Indirection<Fortran::parser::Designator, false>, Fortran::parser::ArrayConstructor, Fortran::parser::StructureConstructor, Fortran::common::Indirection<Fortran::parser::FunctionReference, false>, Fortran::parser::Expr::Parentheses, Fortran::parser::Expr::UnaryPlus, Fortran::parser::Expr::Negate, Fortran::parser::Expr::NOT, Fortran::parser::Expr::PercentLoc, Fortran::parser::Expr::DefinedUnary, Fortran::parser::Expr::Power, Fortran::parser::Expr::Multiply, Fortran::parser::Expr::Divide, Fortran::parser::Expr::Add, Fortran::parser::Expr::Subtract, Fortran::parser::Expr::Concat, Fortran::parser::Expr::LT, Fortran::parser::Expr::LE, Fortran::parser::Expr::EQ, Fortran::parser::Expr::NE, Fortran::parser::Expr::GE, Fortran::parser::Expr::GT, Fortran::parser::Expr::AND, Fortran::parser::Expr::OR, Fortran::parser::Expr::EQV, Fortran::parser::Expr::NEQV, Fortran::parser::Expr::DefinedBinary, Fortran::parser::Expr::ComplexConstructor, Fortran::common::Indirection<Fortran::parser::SubstringInquiry, false>>(std::variant<Fortran::common::Indirection<Fortran::parser::CharLiteralConstantSubstring, false>, Fortran::parser::LiteralConstant, Fortran::common::Indirection<Fortran::parser::Designator, false>, Fortran::parser::ArrayConstructor, Fortran::parser::StructureConstructor, Fortran::common::Indirection<Fortran::parser::FunctionReference, false>, Fortran::parser::Expr::Parentheses, Fortran::parser::Expr::UnaryPlus, Fortran::parser::Expr::Negate, Fortran::parser::Expr::NOT, Fortran::parser::Expr::PercentLoc, Fortran::parser::Expr::DefinedUnary, Fortran::parser::Expr::Power, Fortran::parser::Expr::Multiply, Fortran::parser::Expr::Divide, Fortran::parser::Expr::Add, Fortran::parser::Expr::Subtract, Fortran::parser::Expr::Concat, Fortran::parser::Expr::LT, Fortran::parser::Expr::LE, Fortran::parser::Expr::EQ, Fortran::parser::Expr::NE, Fortran::parser::Expr::GE, Fortran::parser::Expr::GT, Fortran::parser::Expr::AND, Fortran::parser::Expr::OR, Fortran::parser::Expr::EQV, Fortran::parser::Expr::NEQV, Fortran::parser::Expr::DefinedBinary, Fortran::parser::Expr::ComplexConstructor, Fortran::common::Indirection<Fortran::parser::SubstringInquiry, false>> const&)::'lambda'(auto const&), std::variant<Fortran::common::Indirection<Fortran::parser::CharLiteralConstantSubstring, false>, Fortran::parser::LiteralConstant, Fortran::common::Indirection<Fortran::parser::Designator, false>, Fortran::parser::ArrayConstructor, Fortran::parser::StructureConstructor, Fortran::common::Indirection<Fortran::parser::FunctionReference, false>, Fortran::parser::Expr::Parentheses, Fortran::parser::Expr::UnaryPlus, Fortran::parser::Expr::Negate, Fortran::parser::Expr::NOT, Fortran::parser::Expr::PercentLoc, Fortran::parser::Expr::DefinedUnary, Fortran::parser::Expr::Power, Fortran::parser::Expr::Multiply, Fortran::parser::Expr::Divide, Fortran::parser::Expr::Add, Fortran::parser::Expr::Subtract, Fortran::parser::Expr::Concat, Fortran::parser::Expr::LT, Fortran::parser::Expr::LE, Fortran::parser::Expr::EQ, Fortran::parser::Expr::NE, Fortran::parser::Expr::GE, Fortran::parser::Expr::GT, Fortran::parser::Expr::AND, Fortran::parser::Expr::OR, Fortran::parser::Expr::EQV, Fortran::parser::Expr::NEQV, Fortran::parser::Expr::DefinedBinary, Fortran::parser::Expr::ComplexConstructor, Fortran::common::Indirection<Fortran::parser::SubstringInquiry, false>> const&>(std::optional<Fortran::evaluate::Expr<Fortran::evaluate::SomeType>> Fortran::evaluate::ExpressionAnalyzer::Analyze<Fortran::common::Indirection<Fortran::parser::CharLiteralConstantSubstring, false>, Fortran::parser::LiteralConstant, Fortran::common::Indirection<Fortran::parser::Designator, false>, Fortran::parser::ArrayConstructor, Fortran::parser::StructureConstructor, Fortran::common::Indirection<Fortran::parser::FunctionReference, false>, Fortran::parser::Expr::Parentheses, Fortran::parser::Expr::UnaryPlus, Fortran::parser::Expr::Negate, Fortran::parser::Expr::NOT, Fortran::parser::Expr::PercentLoc, Fortran::parser::Expr::DefinedUnary, Fortran::parser::Expr::Power, Fortran::parser::Expr::Multiply, Fortran::parser::Expr::Divide, Fortran::parser::Expr::Add, Fortran::parser::Expr::Subtract, Fortran::parser::Expr::Concat, Fortran::parser::Expr::LT, Fortran::parser::Expr::LE, Fortran::parser::Expr::EQ, Fortran::parser::Expr::NE, Fortran::parser::Expr::GE, Fortran::parser::Expr::GT, Fortran::parser::Expr::AND, Fortran::parser::Expr::OR, Fortran::parser::Expr::EQV, Fortran::parser::Expr::NEQV, Fortran::parser::Expr::DefinedBinary, Fortran::parser::Expr::ComplexConstructor, Fortran::common::Indirection<Fortran::parser::SubstringInquiry, false>>(std::variant<Fortran::common::Indirection<Fortran::parser::CharLiteralConstantSubstring, false>, Fortran::parser::LiteralConstant, Fortran::common::Indirection<Fortran::parser::Designator, false>, Fortran::parser::ArrayConstructor, Fortran::parser::StructureConstructor, Fortran::common::Indirection<Fortran::parser::FunctionReference, false>, Fortran::parser::Expr::Parentheses, Fortran::parser::Expr::UnaryPlus, Fortran::parser::Expr::Negate, Fortran::parser::Expr::NOT, Fortran::parser::Expr::PercentLoc, Fortran::parser::Expr::DefinedUnary, Fortran::parser::Expr::Power, Fortran::parser::Expr::Multiply, Fortran::parser::Expr::Divide, Fortran::parser::Expr::Add, Fortran::parser::Expr::Subtract, Fortran::parser::Expr::Concat, Fortran::parser::Expr::LT, Fortran::parser::Expr::LE, Fortran::parser::Expr::EQ, Fortran::parser::Expr::NE, Fortran::parser::Expr::GE, Fortran::parser::Expr::GT, Fortran::parser::Expr::AND, Fortran::parser::Expr::OR, Fortran::parser::Expr::EQV, Fortran::parser::Expr::NEQV, Fortran::parser::Expr::DefinedBinary, Fortran::parser::Expr::ComplexConstructor, Fortran::common::Indirection<Fortran::parser::SubstringInquiry, false>> const&)::'lambda'(auto const&)&&, unsigned long, std::variant<Fortran::common::Indirection<Fortran::parser::CharLiteralConstantSubstring, false>, Fortran::parser::LiteralConstant, Fortran::common::Indirection<Fortran::parser::Designator, false>, Fortran::parser::ArrayConstructor, Fortran::parser::StructureConstructor, Fortran::common::Indirection<Fortran::parser::FunctionReference, false>, Fortran::parser::Expr::Parentheses, Fortran::parser::Expr::UnaryPlus, Fortran::parser::Expr::Negate, Fortran::parser::Expr::NOT, Fortran::parser::Expr::PercentLoc, Fortran::parser::Expr::DefinedUnary, Fortran::parser::Expr::Power, Fortran::parser::Expr::Multiply, Fortran::parser::Expr::Divide, Fortran::parser::Expr::Add, Fortran::parser::Expr::Subtract, Fortran::parser::Expr::Concat, Fortran::parser::Expr::LT, Fortran::parser::Expr::LE, Fortran::parser::Expr::EQ, Fortran::parser::Expr::NE, Fortran::parser::Expr::GE, Fortran::parser::Expr::GT, Fortran::parser::Expr::AND, Fortran::parser::Expr::OR, Fortran::parser::Expr::EQV, Fortran::parser::Expr::NEQV, Fortran::parser::Expr::DefinedBinary, Fortran::parser::Expr::ComplexConstructor, Fortran::common::Indirection<Fortran::parser::SubstringInquiry, false>> const&) (/opt/compiler-explorer/clang-llvmflang-trunk-20240504/bin/flang-new+0x3ff58ed)
#11 0x0000000003ff5a66 std::optional<Fortran::evaluate::Expr<Fortran::evaluate::SomeType>> Fortran::evaluate::ExpressionAnalyzer::ExprOrVariable<Fortran::parser::Expr>(Fortran::parser::Expr const&, Fortran::parser::CharBlock) (/opt/compiler-explorer/clang-llvmflang-trunk-20240504/bin/flang-new+0x3ff5a66)
#12 0x0000000003ff67ff Fortran::evaluate::ExpressionAnalyzer::IterativelyAnalyzeSubexpressions(Fortran::parser::Expr const&) (/opt/compiler-explorer/clang-llvmflang-trunk-20240504/bin/flang-new+0x3ff67ff)
#13 0x0000000003ff6b95 Fortran::evaluate::ExpressionAnalyzer::Analyze(Fortran::parser::Expr const&) (/opt/compiler-explorer/clang-llvmflang-trunk-20240504/bin/flang-new+0x3ff6b95)
#14 0x0000000003ff6cb7 Fortran::evaluate::ArgumentAnalyzer::AnalyzeExprOrWholeAssumedSizeArray(Fortran::parser::Expr const&) (/opt/compiler-explorer/clang-llvmflang-trunk-20240504/bin/flang-new+0x3ff6cb7)
#15 0x0000000003ff6e8b Fortran::evaluate::ArgumentAnalyzer::AnalyzeExpr(Fortran::parser::Expr const&) (/opt/compiler-explorer/clang-llvmflang-trunk-20240504/bin/flang-new+0x3ff6e8b)
#16 0x0000000003ff7151 Fortran::evaluate::ArgumentAnalyzer::Analyze(Fortran::parser::Expr const&) (/opt/compiler-explorer/clang-llvmflang-trunk-20240504/bin/flang-new+0x3ff7151)
#17 0x000000000400505c Fortran::evaluate::ExpressionAnalyzer::Analyze(Fortran::parser::AssignmentStmt const&) (/opt/compiler-explorer/clang-llvmflang-trunk-20240504/bin/flang-new+0x400505c)
#18 0x0000000004015731 void Fortran::parser::Walk<Fortran::semantics::ExprChecker>(std::__cxx11::list<Fortran::parser::ExecutionPartConstruct, std::allocator<Fortran::parser::ExecutionPartConstruct>> const&, Fortran::semantics::ExprChecker&) (/opt/compiler-explorer/clang-llvmflang-trunk-20240504/bin/flang-new+0x4015731)
#19 0x0000000004016c0f Fortran::semantics::ExprChecker::Walk(Fortran::parser::Program const&) (/opt/compiler-explorer/clang-llvmflang-trunk-20240504/bin/flang-new+0x4016c0f)
#20 0x00000000041190ad Fortran::semantics::Semantics::Perform() (/opt/compiler-explorer/clang-llvmflang-trunk-20240504/bin/flang-new+0x41190ad)
#21 0x00000000037be965 Fortran::frontend::FrontendAction::runSemanticChecks() (/opt/compiler-explorer/clang-llvmflang-trunk-20240504/bin/flang-new+0x37be965)
#22 0x0000000003ae8442 Fortran::frontend::CodeGenAction::beginSourceFileAction() (/opt/compiler-explorer/clang-llvmflang-trunk-20240504/bin/flang-new+0x3ae8442)
#23 0x00000000037bdaf5 Fortran::frontend::FrontendAction::beginSourceFile(Fortran::frontend::CompilerInstance&, Fortran::frontend::FrontendInputFile const&) (/opt/compiler-explorer/clang-llvmflang-trunk-20240504/bin/flang-new+0x37bdaf5)
#24 0x00000000037ad3b7 Fortran::frontend::CompilerInstance::executeAction(Fortran::frontend::FrontendAction&) (/opt/compiler-explorer/clang-llvmflang-trunk-20240504/bin/flang-new+0x37ad3b7)
#25 0x00000000037c3dcd Fortran::frontend::executeCompilerInvocation(Fortran::frontend::CompilerInstance*) (/opt/compiler-explorer/clang-llvmflang-trunk-20240504/bin/flang-new+0x37c3dcd)
#26 0x0000000001f2b608 fc1_main(llvm::ArrayRef<char const*>, char const*) (/opt/compiler-explorer/clang-llvmflang-trunk-20240504/bin/flang-new+0x1f2b608)
#27 0x0000000001e1aaed main (/opt/compiler-explorer/clang-llvmflang-trunk-20240504/bin/flang-new+0x1e1aaed)
#28 0x00007f0503229d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#29 0x00007f0503229e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#30 0x0000000001f2a56e _start (/opt/compiler-explorer/clang-llvmflang-trunk-20240504/bin/flang-new+0x1f2a56e)
flang-new: error: unable to execute command: Aborted (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 b958ef19489e508e367ad530d4512b7710591550)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/compiler-explorer/clang-llvmflang-trunk-20240504/bin
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to