Issue 123075
Summary [flang] CP2K fails to compile due to assertion 'result && "Fell off the end of a type-switch"'
Labels flang
Assignees
Reporter pawosm-arm
    I'm building CP2K from this SHA: https://github.com/cp2k/cp2k/commit/3905869e4cb94c1f9fc3fc3ecca6c77dece2aa01 since the next SHA (https://github.com/cp2k/cp2k/commit/4837b70ec08ad54fc946d169bea3b08710f565ab ) introduces a new code which flang cannot compile (see https://github.com/llvm/llvm-project/issues/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.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
```

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

_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to