From: <sv...@op...> - 2024-07-14 12:59:36
|
Author: manx Date: Sun Jul 14 14:59:29 2024 New Revision: 21162 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21162 Log: [Mod] Reduce impact of <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115049> work-around by instead of forcing -O1 to only setting -fno-ipa-ra on non-ELF platforms. [Mod] build: Makefile: DJGPP: Set -fno-ipa-ra for all code. [Mod] build: Makefile: MinGW-w64: Set -fno-ipa-ra for all code on GCC. [Mod] build: Makefile: MinGW: Set -fno-ipa-ra for all code. [Mod] build: Makefile: MinGW32CRT: Set -fno-ipa-ra for all code. Modified: trunk/OpenMPT/Makefile trunk/OpenMPT/build/make/config-djgpp.mk trunk/OpenMPT/build/make/config-mingw-w64.mk trunk/OpenMPT/build/make/config-mingw.mk trunk/OpenMPT/build/make/config-mingw32crt.mk trunk/OpenMPT/common/BuildSettings.h trunk/OpenMPT/src/mpt/base/detect_quirks.hpp trunk/OpenMPT/src/mpt/check/compiler.hpp Modified: trunk/OpenMPT/Makefile ============================================================================== --- trunk/OpenMPT/Makefile Sun Jul 14 14:32:49 2024 (r21161) +++ trunk/OpenMPT/Makefile Sun Jul 14 14:59:29 2024 (r21162) @@ -585,6 +585,12 @@ endif +ifeq ($(MPT_COMPILER_NOIPARA),1) +# See <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115049>. +CXXFLAGS += -fno-ipa-ra +CFLAGS += -fno-ipa-ra +endif + ifeq ($(CHECKED),1) CPPFLAGS += -DMPT_BUILD_CHECKED CXXFLAGS += -g -fno-omit-frame-pointer Modified: trunk/OpenMPT/build/make/config-djgpp.mk ============================================================================== --- trunk/OpenMPT/build/make/config-djgpp.mk Sun Jul 14 14:32:49 2024 (r21161) +++ trunk/OpenMPT/build/make/config-djgpp.mk Sun Jul 14 14:59:29 2024 (r21162) @@ -477,6 +477,9 @@ OPTIMIZE_FASTMATH=1 +# See <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115049>. +MPT_COMPILER_NOIPARA=1 + include build/make/warnings-gcc.mk ALLOW_LGPL=1 Modified: trunk/OpenMPT/build/make/config-mingw-w64.mk ============================================================================== --- trunk/OpenMPT/build/make/config-mingw-w64.mk Sun Jul 14 14:32:49 2024 (r21161) +++ trunk/OpenMPT/build/make/config-mingw-w64.mk Sun Jul 14 14:59:29 2024 (r21162) @@ -117,6 +117,11 @@ $(error unknown WINDOWS_VERSION) endif +ifneq ($(MINGW_COMPILER),clang) +# See <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115049>. +MPT_COMPILER_NOIPARA=1 +endif + ifeq ($(MINGW_COMPILER),clang) include build/make/warnings-clang.mk else Modified: trunk/OpenMPT/build/make/config-mingw.mk ============================================================================== --- trunk/OpenMPT/build/make/config-mingw.mk Sun Jul 14 14:32:49 2024 (r21161) +++ trunk/OpenMPT/build/make/config-mingw.mk Sun Jul 14 14:59:29 2024 (r21162) @@ -73,6 +73,9 @@ PC_LIBS_PRIVATE += -lole32 -lrpcrt4 +# See <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115049>. +MPT_COMPILER_NOIPARA=1 + include build/make/warnings-gcc.mk EXESUFFIX=.exe Modified: trunk/OpenMPT/build/make/config-mingw32crt.mk ============================================================================== --- trunk/OpenMPT/build/make/config-mingw32crt.mk Sun Jul 14 14:32:49 2024 (r21161) +++ trunk/OpenMPT/build/make/config-mingw32crt.mk Sun Jul 14 14:59:29 2024 (r21162) @@ -73,6 +73,9 @@ PC_LIBS_PRIVATE += -lole32 -lrpcrt4 +# See <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115049>. +MPT_COMPILER_NOIPARA=1 + include build/make/warnings-gcc.mk EXESUFFIX=.exe Modified: trunk/OpenMPT/common/BuildSettings.h ============================================================================== --- trunk/OpenMPT/common/BuildSettings.h Sun Jul 14 14:32:49 2024 (r21161) +++ trunk/OpenMPT/common/BuildSettings.h Sun Jul 14 14:59:29 2024 (r21162) @@ -390,12 +390,10 @@ #if MPT_COMPILER_GCC -#ifdef MPT_COMPILER_QUIRK_GCC_NO_O2 +#ifdef MPT_COMPILER_QUIRK_GCC_NO_IPA_RA // See <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115049>. -#if defined(__OPTIMIZE__) -#pragma GCC optimize("O1") -#endif -#endif // MPT_COMPILER_QUIRK_GCC_NO_O2 +#pragma GCC optimize("no-ipa-ra") +#endif // MPT_COMPILER_QUIRK_GCC_NO_IPA_RA #endif // MPT_COMPILER_GCC Modified: trunk/OpenMPT/src/mpt/base/detect_quirks.hpp ============================================================================== --- trunk/OpenMPT/src/mpt/base/detect_quirks.hpp Sun Jul 14 14:32:49 2024 (r21161) +++ trunk/OpenMPT/src/mpt/base/detect_quirks.hpp Sun Jul 14 14:59:29 2024 (r21162) @@ -19,11 +19,13 @@ -#if MPT_GCC_AT_LEAST(14, 0, 0) && MPT_GCC_BEFORE(15, 0, 0) -// GCC 14 causes severe miscompilation of inline functions. +#if MPT_COMPILER_GCC +// GCC 14 causes severe miscompilation of inline functions on MinGW. // See <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115049>. -#if defined(__OPTIMIZE__) -#define MPT_COMPILER_QUIRK_GCC_NO_O2 +// Current investigation suggests a general problem with -fipa-ra on non-ELF +// platforms. +#if !defined(__ELF__) +#define MPT_COMPILER_QUIRK_GCC_NO_IPA_RA #endif #endif Modified: trunk/OpenMPT/src/mpt/check/compiler.hpp ============================================================================== --- trunk/OpenMPT/src/mpt/check/compiler.hpp Sun Jul 14 14:32:49 2024 (r21161) +++ trunk/OpenMPT/src/mpt/check/compiler.hpp Sun Jul 14 14:59:29 2024 (r21162) @@ -7,13 +7,6 @@ #include "mpt/base/detect_quirks.hpp" #include "mpt/base/compiletime_warning.hpp" -#ifndef MPT_CHECK_CXX_IGNORE_WARNING_O2 -#if defined(MPT_COMPILER_QUIRK_GCC_NO_O2) -// See <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115049>. -MPT_WARNING("GCC 14 is known to cause severe miscompilation of inline functions. OpenMPT has forced optimization settings down to -O1. This comes at a roughly 15% performance cost. It is strongly recommended to stay with GCC 13 for the time being. You will need to edit the source to opt-out of this safety guard.") -#endif -#endif - #ifndef MPT_CHECK_CXX_IGNORE_PREPROCESSOR #if defined(MPT_COMPILER_QUIRK_MSVC_OLD_PREPROCESSOR) MPT_WARNING("C++ preprocessor is not standard conformings.") |