]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gcc: drop placement new workaround for old bootstrap compilers
authorSam James <sam@gentoo.org>
Sat, 2 Aug 2025 12:57:03 +0000 (13:57 +0100)
committerSam James <sam@gentoo.org>
Wed, 6 Aug 2025 16:46:06 +0000 (17:46 +0100)
Since r15-4719-ga9ec1bc06bd3cc, we require GCC 5.4, so a workaround for
< GCC 4.3 is long-obsolete. Before that, we required GCC 4.8.3 too.

i.e. it shouldn't be possible to build GCC with such a compiler for
quite some time.

gcc/ChangeLog:
PR libstdc++/29286
* Makefile.in (ALIASING_FLAGS): Drop.
* configure: Regenerate.
* configure.ac: Drop -fno-strict-aliasing workaround for < GCC 4.3.

gcc/d/ChangeLog:

* Make-lang.in (ALL_DFLAGS): Don't use ALIASING_FLAGS.

gcc/Makefile.in
gcc/configure
gcc/configure.ac
gcc/d/Make-lang.in

index 3406517934739af6786151e6632b7c55a555735f..cc79595dd22a3645e3c5765b81d7586cf6ef4413 100644 (file)
@@ -187,8 +187,6 @@ C_STRICT_WARN = @c_strict_warn@
 
 NOEXCEPTION_FLAGS = @noexception_flags@
 
-ALIASING_FLAGS = @aliasing_flags@
-
 # This is set by --disable-maintainer-mode (default) to "#"
 # FIXME: 'MAINT' will always be set to an empty string, no matter if
 # --disable-maintainer-mode is used or not.  This is because the
index bacdd29da69a8bd88b99d7a2088424359b8ebf67..cab9c750f03d6ced9b932351109f658690cd80f1 100755 (executable)
@@ -872,7 +872,6 @@ c_strict_warn
 strict_warn
 c_loose_warn
 loose_warn
-aliasing_flags
 CPP
 EGREP
 GREP
@@ -7126,45 +7125,6 @@ $as_echo "#define HAVE_SWAP_IN_UTILITY 1" >>confdefs.h
 
 fi
 
-# Check whether compiler is affected by placement new aliasing bug (PR 29286).
-# If the host compiler is affected by the bug, and we build with optimization
-# enabled (which happens e.g. when cross-compiling), the pool allocator may
-# get miscompiled.  Use -fno-strict-aliasing to work around this problem.
-# Since there is no reliable feature check for the presence of this bug,
-# we simply use a GCC version number check.  (This should never trigger for
-# stages 2 or 3 of a native bootstrap.)
-aliasing_flags=
-if test "$GCC" = yes; then
-  saved_CXXFLAGS="$CXXFLAGS"
-
-  # The following test compilation will succeed if and only if $CXX accepts
-  # -fno-strict-aliasing *and* is older than GCC 4.3.
-  CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX is affected by placement new aliasing bug" >&5
-$as_echo_n "checking whether $CXX is affected by placement new aliasing bug... " >&6; }
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
-#error compiler not affected by placement new aliasing bug
-#endif
-
-_ACEOF
-if ac_fn_cxx_try_compile "$LINENO"; then :
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }; aliasing_flags='-fno-strict-aliasing'
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
-  CXXFLAGS="$saved_CXXFLAGS"
-fi
-
-
-
-
 # ---------------------
 # Warnings and checking
 # ---------------------
@@ -21522,7 +21482,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 21525 "configure"
+#line 21485 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -21628,7 +21588,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 21631 "configure"
+#line 21591 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
index 2c43b38178c74578a5d61119783894075e560fad..ac1f0e9445169df3ec28d03e1b57f8b0f5a14df0 100644 (file)
@@ -563,35 +563,6 @@ if test $ac_cv_std_swap_in_utility = yes; then
   [Define if <utility> defines std::swap.])
 fi
 
-# Check whether compiler is affected by placement new aliasing bug (PR 29286).
-# If the host compiler is affected by the bug, and we build with optimization
-# enabled (which happens e.g. when cross-compiling), the pool allocator may
-# get miscompiled.  Use -fno-strict-aliasing to work around this problem.
-# Since there is no reliable feature check for the presence of this bug,
-# we simply use a GCC version number check.  (This should never trigger for
-# stages 2 or 3 of a native bootstrap.)
-aliasing_flags=
-if test "$GCC" = yes; then
-  saved_CXXFLAGS="$CXXFLAGS"
-
-  # The following test compilation will succeed if and only if $CXX accepts
-  # -fno-strict-aliasing *and* is older than GCC 4.3.
-  CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
-  AC_MSG_CHECKING([whether $CXX is affected by placement new aliasing bug])
-  AC_COMPILE_IFELSE([AC_LANG_SOURCE([
-#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
-#error compiler not affected by placement new aliasing bug
-#endif
-])],
-    [AC_MSG_RESULT([yes]); aliasing_flags='-fno-strict-aliasing'],
-    [AC_MSG_RESULT([no])])
-
-  CXXFLAGS="$saved_CXXFLAGS"
-fi
-AC_SUBST(aliasing_flags)
-
-
-
 # ---------------------
 # Warnings and checking
 # ---------------------
index 2d444c9995304dd180389c9eb9b486bc6f05d75d..0ddd5242812ecdc8cf86dd6246f36d0d2b38bc2c 100644 (file)
@@ -61,7 +61,7 @@ WARN_DFLAGS = -Wall -Wdeprecated
 NOEXCEPTION_DFLAGS = $(filter-out -fno-rtti, $(NOEXCEPTION_FLAGS))
 
 ALL_DFLAGS = $(DFLAGS-$@) $(GDCFLAGS) -fversion=IN_GCC $(CHECKING_DFLAGS) \
-       $(PICFLAG) $(ALIASING_FLAGS) $(NOEXCEPTION_DFLAGS) $(COVERAGE_FLAGS) \
+       $(PICFLAG) $(NOEXCEPTION_DFLAGS) $(COVERAGE_FLAGS) \
        $(WARN_DFLAGS)
 
 DCOMPILE.base = $(GDC) -c $(ALL_DFLAGS) -o $@