Skip to content

Commit cbaf8d3

Browse files
committed
Disable loop vectorization for GNU Fortran 14.0-14.4 and 15.0-15.2 on ARM due to a compiler bug.
1 parent d502606 commit cbaf8d3

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

CMAKE/CheckLAPACKCompilerFlags.cmake

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,19 @@ macro(CheckLAPACKCompilerFlags)
5959
add_compile_definitions("$<$<COMPILE_LANGUAGE:C>:FORTRAN_STRLEN=int>")
6060
endif()
6161

62+
# Disabling loop vectorization for GNU Fortran versions affected by
63+
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122408. See issue
64+
# https://github.com/Reference-LAPACK/lapack/issues/1160 as well.
65+
if(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "arm|arm64|aarch64")
66+
if((CMAKE_Fortran_COMPILER_VERSION VERSION_GREATER_EQUAL "14.0" AND
67+
CMAKE_Fortran_COMPILER_VERSION VERSION_LESS_EQUAL "14.4") OR
68+
(CMAKE_Fortran_COMPILER_VERSION VERSION_GREATER_EQUAL "15.0" AND
69+
CMAKE_Fortran_COMPILER_VERSION VERSION_LESS_EQUAL "15.2"))
70+
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.")
71+
add_compile_options("$<$<COMPILE_LANGUAGE:Fortran>:-fno-tree-loop-vectorize>")
72+
endif()
73+
endif()
74+
6275
# Intel Fortran
6376
elseif(CMAKE_Fortran_COMPILER_ID MATCHES "Intel")
6477
set(FPE_EXIT_FLAG "[-/]fpe(-all=|)0")

0 commit comments

Comments
 (0)