Skip to content

Commit 3008e14

Browse files
committed
cmake: disable dead store and dead code optimizations when using GCC 15
rtest segfaults when using GCC 15 with optimzations enabled. Disable these specific optimizations.
1 parent b1a5626 commit 3008e14

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,12 @@ if (NOT WIN32)
9090
add_compile_options(-Wall -Wextra -pedantic -Wvolatile)
9191
endif ()
9292

93+
# Disable dead store and dead code elimination when using GCC 15 or newer. This may be a
94+
# compiler bug. "rtest" segfaults when these optimizations are enabled.
95+
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "15")
96+
add_compile_options(-fno-tree-dce -fno-tree-dse)
97+
endif()
98+
9399
if (MSVC)
94100
add_definitions(
95101
# forcing value to bool 'true' or 'false' (performance warning)

0 commit comments

Comments
 (0)