Skip to content

[flang] CP2K fails to compile due to assertion 'result && "Fell off the end of a type-switch"' #123075

@pawosm-arm

Description

@pawosm-arm

I'm building CP2K from this SHA: cp2k/cp2k@3905869 since the next SHA (cp2k/cp2k@4837b70 ) introduces a new code which flang cannot compile (see #108827 closed issue but the problem still occurs). Unfortunately, very late in the process, the compilation fails on the https://github.com/cp2k/cp2k/blob/master/src/transport.F file as such:

llvm/ADT/TypeSwitch.h:121: llvm::TypeSwitch<T, ResultT>::operator ResultT() [with T = mlir::Type; ResultT = {anonymous}::TargetAArch64::NRegs]: Assertion `result && "Fell off the end of a type-switch"' failed.

Execution command line (including fypp preprocessing):

tools/build_utils/fypp -n src/transport.F transport.F90

mpifort -fno-backslash -c -D__FFTW3 -D__parallel -D__SCALAPACK -ffp-contract=fast -O3 -fopenmp -mcpu=native -ffree-form -D__COMPILE_ARCH="\"Linux-LLVM-flang\"" -D__COMPILE_DATE="\"Tue 14 Jan 23:36:31 UTC 2025\"" -D__COMPILE_HOST="\"host\"" -D__COMPILE_REVISION="\"git:3905869\"" -D__DATA_DIR="\"data\"" -D__SHORT_FILE__="\"transport.F\"" -I'src/' -I'obj/Linux-LLVM-flang/psmp/exts/dbcsr' transport.F90

The problem goes away after commenting out the following line: https://github.com/cp2k/cp2k/blob/f8b3abcd3ac413146004a9ebf8d71317c9449627/src/transport.F#L419

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions