Skip to content

[flang] ICE: not a typeless expr #116388

@mathomp4

Description

@mathomp4

We have encountered a bug in flang compilation. We aren't exactly sure what is happening, so I don't have a good description. The flang version is:

> flang --version
flang version 20.0.0git ([email protected]:GEOS-ESM/build-llvm-flang.git 697744d14fec6505d07f95249388ac2452ee5151)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /ford1/share/gmao_SIteam/llvm-flang/2024-10-22/bin

so our flang is about 3 weeks old. I hope to have time next week to build the latest flang from main so maybe this is fixed, but I can't confirm this.

Traceback:

error: loc("/home/mathomp4/F90Files/flang-repro/reproducer.F90":12:7): not a typeless expr
LLVM ERROR: aborting
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.	Program arguments: /ford1/share/gmao_SIteam/llvm-flang/2024-10-22/bin/flang -fc1 -triple x86_64-unknown-linux-gnu -emit-obj -fcolor-diagnostics -mrelocation-model pic -pic-level 2 -pic-is-pie -target-cpu x86-64 -resource-dir /ford1/share/gmao_SIteam/llvm-flang/2024-10-22/lib/clang/20 -mframe-pointer=all -o reproducer.o -x f95-cpp-input reproducer.F90
 #0 0x000000000152e05b llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/ford1/share/gmao_SIteam/llvm-flang/2024-10-22/bin/flang+0x152e05b)
 #1 0x000000000152b77b SignalHandler(int) Signals.cpp:0:0
 #2 0x0000149a3cbfdd10 __restore_rt (/lib64/libpthread.so.0+0x12d10)
 #3 0x0000149a3b3a052f raise (/lib64/libc.so.6+0x4e52f)
 #4 0x0000149a3b373e65 abort (/lib64/libc.so.6+0x21e65)
 #5 0x0000000000f4b0be llvm::UniqueStringSaver::save(llvm::StringRef) (.cold) StringSaver.cpp:0:0
 #6 0x00000000014b933a (/ford1/share/gmao_SIteam/llvm-flang/2024-10-22/bin/flang+0x14b933a)
 #7 0x0000000001d26cd3 (/ford1/share/gmao_SIteam/llvm-flang/2024-10-22/bin/flang+0x1d26cd3)
 #8 0x0000000001f5a8a1 mlir::Type (anonymous namespace)::TypeBuilderImpl::genExprType<Fortran::evaluate::FunctionRef<Fortran::evaluate::Type<(Fortran::common::TypeCategory)3, 2>>>(Fortran::evaluate::FunctionRef<Fortran::evaluate::Type<(Fortran::common::TypeCategory)3, 2>> const&) ConvertType.cpp:0:0
 #9 0x0000000001f5ae3a Fortran::lower::TypeBuilder<Fortran::evaluate::Type<(Fortran::common::TypeCategory)3, 1>>::genType(Fortran::lower::AbstractConverter&, Fortran::evaluate::FunctionRef<Fortran::evaluate::Type<(Fortran::common::TypeCategory)3, 1>> const&) (/ford1/share/gmao_SIteam/llvm-flang/2024-10-22/bin/flang+0x1f5ae3a)
#10 0x0000000001f47ab4 hlfir::EntityWithAttributes (anonymous namespace)::HlfirBuilder::gen<Fortran::evaluate::Type<(Fortran::common::TypeCategory)3, 1>>(Fortran::evaluate::Expr<Fortran::evaluate::Type<(Fortran::common::TypeCategory)3, 1>> const&) ConvertExprToHLFIR.cpp:0:0
#11 0x0000000001f42abe hlfir::EntityWithAttributes (anonymous namespace)::HlfirBuilder::gen<Fortran::evaluate::SomeKind<(Fortran::common::TypeCategory)3>>(Fortran::evaluate::Expr<Fortran::evaluate::SomeKind<(Fortran::common::TypeCategory)3>> const&) ConvertExprToHLFIR.cpp:0:0
#12 0x0000000001f50cf1 hlfir::EntityWithAttributes (anonymous namespace)::HlfirBuilder::gen<Fortran::evaluate::SomeType>(Fortran::evaluate::Expr<Fortran::evaluate::SomeType> const&) (.part.0) ConvertExprToHLFIR.cpp:0:0
#13 0x0000000001f51073 Fortran::lower::convertExprToHLFIR(mlir::Location, Fortran::lower::AbstractConverter&, Fortran::evaluate::Expr<Fortran::evaluate::SomeType> const&, Fortran::lower::SymMap&, Fortran::lower::StatementContext&) (/ford1/share/gmao_SIteam/llvm-flang/2024-10-22/bin/flang+0x1f51073)
#14 0x0000000001d49903 (anonymous namespace)::FirConverter::genDataAssignment(Fortran::evaluate::Assignment const&, Fortran::evaluate::ProcedureRef const*) Bridge.cpp:0:0
#15 0x0000000001d6038a (anonymous namespace)::FirConverter::genAssignment(Fortran::evaluate::Assignment const&) Bridge.cpp:0:0
#16 0x0000000001d75f90 (anonymous namespace)::FirConverter::genFIR(Fortran::lower::pft::Evaluation&, bool) (.constprop.0) Bridge.cpp:0:0
#17 0x0000000001d7a68d (anonymous namespace)::FirConverter::lowerFunc(Fortran::lower::pft::FunctionLikeUnit&) Bridge.cpp:0:0
#18 0x0000000001d7c149 Fortran::lower::LoweringBridge::lower(Fortran::parser::Program const&, Fortran::semantics::SemanticsContext const&) (/ford1/share/gmao_SIteam/llvm-flang/2024-10-22/bin/flang+0x1d7c149)
#19 0x0000000001cef409 Fortran::frontend::CodeGenAction::beginSourceFileAction() (/ford1/share/gmao_SIteam/llvm-flang/2024-10-22/bin/flang+0x1cef409)
#20 0x000000000156a3f5 Fortran::frontend::FrontendAction::beginSourceFile(Fortran::frontend::CompilerInstance&, Fortran::frontend::FrontendInputFile const&) (/ford1/share/gmao_SIteam/llvm-flang/2024-10-22/bin/flang+0x156a3f5)
#21 0x00000000015599fc Fortran::frontend::CompilerInstance::executeAction(Fortran::frontend::FrontendAction&) (/ford1/share/gmao_SIteam/llvm-flang/2024-10-22/bin/flang+0x15599fc)
#22 0x000000000157258d Fortran::frontend::executeCompilerInvocation(Fortran::frontend::CompilerInstance*) (/ford1/share/gmao_SIteam/llvm-flang/2024-10-22/bin/flang+0x157258d)
#23 0x0000000001071388 fc1_main(llvm::ArrayRef<char const*>, char const*) (/ford1/share/gmao_SIteam/llvm-flang/2024-10-22/bin/flang+0x1071388)
#24 0x0000000000f93dd6 main (/ford1/share/gmao_SIteam/llvm-flang/2024-10-22/bin/flang+0xf93dd6)
#25 0x0000149a3b38c7e5 __libc_start_main (/lib64/libc.so.6+0x3a7e5)
#26 0x000000000107035e _start (/ford1/share/gmao_SIteam/llvm-flang/2024-10-22/bin/flang+0x107035e)
flang-20: error: unable to execute command: Aborted (core dumped)
flang-20: error: flang frontend command failed due to signal (use -v to see invocation)
flang version 20.0.0git ([email protected]:GEOS-ESM/build-llvm-flang.git 697744d14fec6505d07f95249388ac2452ee5151)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /ford1/share/gmao_SIteam/llvm-flang/2024-10-22/bin
flang-20: note: diagnostic msg:
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
flang-20: note: diagnostic msg: /home/mathomp4/tmpdir/HConfig-0c62c2
flang-20: note: diagnostic msg: /home/mathomp4/tmpdir/cutdown_module-3b0a59
flang-20: note: diagnostic msg: /home/mathomp4/tmpdir/reproducer-fb6cdb
flang-20: note: diagnostic msg: /home/mathomp4/tmpdir/HConfig-0c62c2.sh
flang-20: note: diagnostic msg:

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

Per instructions here are the preprocessed source files (in a tarfile as it didn't like the separate ones):

files-from-flang-crash.tar.gz

We also have the original files which produced these if needed.

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions