From e42bd388653af9b1b5f075dc0705fb917a625ec9 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Fri, 21 Mar 2025 12:02:59 -0700 Subject: [PATCH] compiler_flags: Change optimization_fast from '-Ofast' to '-O3' '-Ofast' enables optimizations that are not standards compliant, which can produce unexpected results unless used carefully. When building with clang 19 and newer, it warns: clang: error: argument '-Ofast' is deprecated; use '-O3 -ffast-math' for the same behavior, or '-O3' to enable only conforming optimizations [-Werror,-Wdeprecated-ofast] Relevant discussion: * https://github.com/llvm/llvm-project/pull/98736 * https://discourse.llvm.org/t/rfc-deprecate-ofast/78687/109 * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115990 Signed-off-by: Tom Hughes --- cmake/compiler/gcc/compiler_flags.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/compiler/gcc/compiler_flags.cmake b/cmake/compiler/gcc/compiler_flags.cmake index 48afd244ac72..11c6dc1d5156 100644 --- a/cmake/compiler/gcc/compiler_flags.cmake +++ b/cmake/compiler/gcc/compiler_flags.cmake @@ -21,7 +21,7 @@ endif() set_compiler_property(PROPERTY optimization_speed -O2) set_compiler_property(PROPERTY optimization_size -Os) set_compiler_property(PROPERTY optimization_size_aggressive -Oz) -set_compiler_property(PROPERTY optimization_fast -Ofast) +set_compiler_property(PROPERTY optimization_fast -O3) if(CMAKE_C_COMPILER_VERSION GREATER_EQUAL "4.5.0") set_compiler_property(PROPERTY optimization_lto -flto=auto)