Disable -ftrivial-auto-var-init=pattern on GCC < 14.2

GCC generates broken code with that option enabled, see
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115527 .

For simplicity I'm not building a comprehensive set of GCC versions
which do have the fix applied; I'll just exclude old ones.

Change-Id: Ia2f128cac633f8d72d5aedc5efe4e64e1c40c51b
Fixes: QTBUG-127507
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 6c11f40701e9a406942dbcd2920c9b7d56b4af72)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Giuseppe D'Angelo 2024-07-24 21:00:43 +02:00 committed by Qt Cherry-pick Bot
parent 8d99b980e6
commit 0fa33b8c61

View File

@ -487,10 +487,13 @@ if(NOT CLANG) # https://gitlab.kitware.com/cmake/cmake/-/issues/21998
endif()
# trivial_auto_var_init_pattern
qt_config_compiler_supports_flag_test(trivial_auto_var_init_pattern
LABEL "-ftrivial-auto-var-init=pattern support"
FLAG "-ftrivial-auto-var-init=pattern"
)
if(NOT GCC OR CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "14.2.0")
# Causes broken codegen on GCC https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115527
qt_config_compiler_supports_flag_test(trivial_auto_var_init_pattern
LABEL "-ftrivial-auto-var-init=pattern support"
FLAG "-ftrivial-auto-var-init=pattern"
)
endif()
# intelcet
if(MSVC)