Skip to content

Commit 9919c29

Browse files
committed
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: * llvm/llvm-project#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 <[email protected]>
1 parent a117d12 commit 9919c29

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

cmake/compiler/gcc/compiler_flags.cmake

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ endif()
2121
set_compiler_property(PROPERTY optimization_speed -O2)
2222
set_compiler_property(PROPERTY optimization_size -Os)
2323
set_compiler_property(PROPERTY optimization_size_aggressive -Oz)
24-
set_compiler_property(PROPERTY optimization_fast -Ofast)
24+
set_compiler_property(PROPERTY optimization_fast -O3)
2525

2626
if(CMAKE_C_COMPILER_VERSION GREATER_EQUAL "4.5.0")
2727
set_compiler_property(PROPERTY optimization_lto -flto=auto)

0 commit comments

Comments
 (0)