From cbaf8d377f77f1fe3cbec537010252950e73eccf Mon Sep 17 00:00:00 2001 From: Simon Maertens Date: Fri, 14 Nov 2025 14:48:08 +0100 Subject: [PATCH 1/2] Disable loop vectorization for GNU Fortran 14.0-14.4 and 15.0-15.2 on ARM due to a compiler bug. --- CMAKE/CheckLAPACKCompilerFlags.cmake | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/CMAKE/CheckLAPACKCompilerFlags.cmake b/CMAKE/CheckLAPACKCompilerFlags.cmake index 7747564e2..589468c17 100644 --- a/CMAKE/CheckLAPACKCompilerFlags.cmake +++ b/CMAKE/CheckLAPACKCompilerFlags.cmake @@ -59,6 +59,19 @@ macro(CheckLAPACKCompilerFlags) add_compile_definitions("$<$:FORTRAN_STRLEN=int>") endif() + # Disabling loop vectorization for GNU Fortran versions affected by + # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122408. See issue + # https://github.com/Reference-LAPACK/lapack/issues/1160 as well. + if(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "arm|arm64|aarch64") + if((CMAKE_Fortran_COMPILER_VERSION VERSION_GREATER_EQUAL "14.0" AND + CMAKE_Fortran_COMPILER_VERSION VERSION_LESS_EQUAL "14.4") OR + (CMAKE_Fortran_COMPILER_VERSION VERSION_GREATER_EQUAL "15.0" AND + CMAKE_Fortran_COMPILER_VERSION VERSION_LESS_EQUAL "15.2")) + message(WARNING "Disabling loop vectorization for GNU Fortran (14.0-14.4, 15.0-15.2) on ARM due to a compiler bug (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122408). For full performance, consider changing to a different compiler or compiler version.") + add_compile_options("$<$:-fno-tree-loop-vectorize>") + endif() + endif() + # Intel Fortran elseif(CMAKE_Fortran_COMPILER_ID MATCHES "Intel") set(FPE_EXIT_FLAG "[-/]fpe(-all=|)0") From 54726b81773e3d493707eebb24ee12f3c7eb7579 Mon Sep 17 00:00:00 2001 From: Simon Maertens Date: Fri, 14 Nov 2025 14:51:38 +0100 Subject: [PATCH 2/2] Format message better. --- CMAKE/CheckLAPACKCompilerFlags.cmake | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CMAKE/CheckLAPACKCompilerFlags.cmake b/CMAKE/CheckLAPACKCompilerFlags.cmake index 589468c17..2aa2a0aba 100644 --- a/CMAKE/CheckLAPACKCompilerFlags.cmake +++ b/CMAKE/CheckLAPACKCompilerFlags.cmake @@ -67,7 +67,10 @@ macro(CheckLAPACKCompilerFlags) CMAKE_Fortran_COMPILER_VERSION VERSION_LESS_EQUAL "14.4") OR (CMAKE_Fortran_COMPILER_VERSION VERSION_GREATER_EQUAL "15.0" AND CMAKE_Fortran_COMPILER_VERSION VERSION_LESS_EQUAL "15.2")) - message(WARNING "Disabling loop vectorization for GNU Fortran (14.0-14.4, 15.0-15.2) on ARM due to a compiler bug (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122408). For full performance, consider changing to a different compiler or compiler version.") + message(WARNING + "Disabling loop vectorization for GNU Fortran (14.0-14.4, 15.0-15.2) on ARM " + "due to a compiler bug (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122408). " + "For full performance, consider changing to a different compiler or compiler version.") add_compile_options("$<$:-fno-tree-loop-vectorize>") endif() endif()