import CS gcc-toolset-14-gcc-14.2.1-11.el9_7

This commit is contained in:
eabdullin 2025-09-15 11:32:50 +00:00
parent 25d7d4233d
commit c337d6d28d
5 changed files with 286 additions and 20 deletions

View File

@ -0,0 +1,81 @@
From 9d5baaa92c6609191fd2488389562ac1ad1f0fb2 Mon Sep 17 00:00:00 2001
From: Jonathan Wakely <jwakely@redhat.com>
Date: Fri, 28 Mar 2025 15:41:41 +0000
Subject: [PATCH] libstdc++: Fix -Warray-bounds warning in std::vector<bool>
[PR110498]
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
In this case, we need to tell the compiler that the current size is not
larger than the new size so that all the existing elements can be copied
to the new storage. This avoids bogus warnings about overflowing the new
storage when the compiler can't tell that that cannot happen.
We might as well also hoist the loads of begin() and end() before the
allocation too. All callers will have loaded at least begin() before
calling _M_reallocate.
libstdc++-v3/ChangeLog:
PR libstdc++/110498
* include/bits/vector.tcc (vector<bool, A>::_M_reallocate):
Hoist loads of begin() and end() before allocation and use them
to state an unreachable condition.
* testsuite/23_containers/vector/bool/capacity/110498.cc: New
test.
Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
(cherry picked from commit aa3aaf2bfb8fcc17076993df4297597b68bc5f60)
---
libstdc++-v3/include/bits/vector.tcc | 5 ++++-
.../vector/bool/capacity/110498.cc | 18 ++++++++++++++++++
2 files changed, 22 insertions(+), 1 deletion(-)
create mode 100644 libstdc++-v3/testsuite/23_containers/vector/bool/capacity/110498.cc
diff --git a/libstdc++-v3/include/bits/vector.tcc b/libstdc++-v3/include/bits/vector.tcc
index dafc2a31a8b..c59c15beacd 100644
--- a/libstdc++-v3/include/bits/vector.tcc
+++ b/libstdc++-v3/include/bits/vector.tcc
@@ -1059,9 +1059,12 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
vector<bool, _Alloc>::
_M_reallocate(size_type __n)
{
+ const iterator __begin = begin(), __end = end();
+ if (size_type(__end - __begin) > __n)
+ __builtin_unreachable();
_Bit_pointer __q = this->_M_allocate(__n);
iterator __start(std::__addressof(*__q), 0);
- iterator __finish(_M_copy_aligned(begin(), end(), __start));
+ iterator __finish(_M_copy_aligned(__begin, __end, __start));
this->_M_deallocate();
this->_M_impl._M_start = __start;
this->_M_impl._M_finish = __finish;
diff --git a/libstdc++-v3/testsuite/23_containers/vector/bool/capacity/110498.cc b/libstdc++-v3/testsuite/23_containers/vector/bool/capacity/110498.cc
new file mode 100644
index 00000000000..d2d09e10d19
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/bool/capacity/110498.cc
@@ -0,0 +1,18 @@
+// { dg-options "-O3 -Werror=array-bounds" }
+// { dg-do compile }
+
+// Bug libstdc++/110498
+// Spurious warnings stringop-overflow and array-bounds copying data as bytes
+// into vector::reserve
+
+#include <vector>
+
+void f(std::vector<bool>& v)
+{
+ // Warning emitted when set to any number in the range [1,64].
+ const std::size_t reserve_size = 30;
+
+ v.reserve(reserve_size);
+ v.push_back(0);
+}
+
--
2.49.0

View File

@ -0,0 +1,39 @@
From 021ccf9dee0c14455a205f2555326e027e9047d8 Mon Sep 17 00:00:00 2001
From: Richard Sandiford <richard.sandiford@arm.com>
Date: Wed, 16 Apr 2025 13:20:25 +0100
Subject: [PATCH] Make force_subreg emit nothing on failure
While adding more uses of force_subreg, I realised that it should
be more careful to emit no instructions on failure. This kind of
failure should be very rare, so I don't think it's a case worth
optimising for.
gcc/
* explow.cc (force_subreg): Emit no instructions on failure.
(cherry picked from commit 01044471ea39f9be4803c583ef2a946abc657f99)
---
gcc/explow.cc | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/gcc/explow.cc b/gcc/explow.cc
index f6843398c4b..bd93c878064 100644
--- a/gcc/explow.cc
+++ b/gcc/explow.cc
@@ -756,8 +756,12 @@ force_subreg (machine_mode outermode, rtx op,
if (x)
return x;
+ auto *start = get_last_insn ();
op = copy_to_mode_reg (innermode, op);
- return simplify_gen_subreg (outermode, op, innermode, byte);
+ rtx res = simplify_gen_subreg (outermode, op, innermode, byte);
+ if (!res)
+ delete_insns_since (start);
+ return res;
}
/* If X is a memory ref, copy its contents to a new temp reg and return
--
2.50.1

View File

@ -0,0 +1,67 @@
From b33e9eb8d404475a45a53afa3e3cc0ff742d75ec Mon Sep 17 00:00:00 2001
From: Richard Sandiford <richard.sandiford@arm.com>
Date: Wed, 16 Apr 2025 13:20:26 +0100
Subject: [PATCH] Add force_lowpart_subreg
optabs had a local function called lowpart_subreg_maybe_copy
that is very similar to the lowpart version of force_subreg.
This patch adds a force_lowpart_subreg wrapper around
force_subreg.
The only difference between the old and new functions is that
the old one asserted success while the new one doesn't.
It's common not to assert elsewhere when taking subregs;
normally a null result is enough.
Later patches will make more use of the new function.
gcc/
* explow.h (force_lowpart_subreg): Declare.
* explow.cc (force_lowpart_subreg): New function.
(cherry picked from commit 5f40d1c0cc6ce91ef28d326b8707b3f05e6f239c)
---
gcc/explow.cc | 14 ++++++++++++++
gcc/explow.h | 1 +
2 files changed, 15 insertions(+)
diff --git a/gcc/explow.cc b/gcc/explow.cc
index bd93c878064..2a91cf76ea6 100644
--- a/gcc/explow.cc
+++ b/gcc/explow.cc
@@ -764,6 +764,20 @@ force_subreg (machine_mode outermode, rtx op,
return res;
}
+/* Try to return an rvalue expression for the OUTERMODE lowpart of OP,
+ which has mode INNERMODE. Allow OP to be forced into a new register
+ if necessary.
+
+ Return null on failure. */
+
+rtx
+force_lowpart_subreg (machine_mode outermode, rtx op,
+ machine_mode innermode)
+{
+ auto byte = subreg_lowpart_offset (outermode, innermode);
+ return force_subreg (outermode, op, innermode, byte);
+}
+
/* If X is a memory ref, copy its contents to a new temp reg and return
that reg. Otherwise, return X. */
diff --git a/gcc/explow.h b/gcc/explow.h
index cbd1fcb7eb3..dd654649b06 100644
--- a/gcc/explow.h
+++ b/gcc/explow.h
@@ -43,6 +43,7 @@ extern rtx copy_to_suggested_reg (rtx, rtx, machine_mode);
extern rtx force_reg (machine_mode, rtx);
extern rtx force_subreg (machine_mode, rtx, machine_mode, poly_uint64);
+extern rtx force_lowpart_subreg (machine_mode, rtx, machine_mode);
/* Return given rtx, copied into a new temp reg if it was in memory. */
extern rtx force_not_mem (rtx);
--
2.50.1

View File

@ -0,0 +1,62 @@
From 9ce381170ed40874230db05111f8837475634e4b Mon Sep 17 00:00:00 2001
From: Tamar Christina <tamar.christina@arm.com>
Date: Mon, 28 Apr 2025 12:58:37 +0100
Subject: [PATCH] aarch64: force operand to fresh register to avoid subreg
issues [PR118892]
When the input is already a subreg and we try to make a paradoxical
subreg out of it for copysign this can fail if it violates the subreg
relationship.
Use force_lowpart_subreg instead of lowpart_subreg to then force the
results to a register instead of ICEing.
gcc/ChangeLog:
PR target/118892
* config/aarch64/aarch64.md (copysign<GPF:mode>3): Use
force_lowpart_subreg instead of lowpart_subreg.
gcc/testsuite/ChangeLog:
PR target/118892
* gcc.target/aarch64/copysign-pr118892.c: New test.
---
gcc/config/aarch64/aarch64.md | 2 +-
gcc/testsuite/gcc.target/aarch64/copysign-pr118892.c | 11 +++++++++++
2 files changed, 12 insertions(+), 1 deletion(-)
create mode 100644 gcc/testsuite/gcc.target/aarch64/copysign-pr118892.c
diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md
index 95577b325ce..6a481059bf0 100644
--- a/gcc/config/aarch64/aarch64.md
+++ b/gcc/config/aarch64/aarch64.md
@@ -7210,7 +7210,7 @@ (define_expand "copysign<GPF:mode>3"
emit_insn (gen_iorv2<v_int_equiv>3 (
lowpart_subreg (V2<V_INT_EQUIV>mode, operands[0], <MODE>mode),
- lowpart_subreg (V2<V_INT_EQUIV>mode, operands[1], <MODE>mode),
+ force_lowpart_subreg (V2<V_INT_EQUIV>mode, operands[1], <MODE>mode),
v_bitmask));
DONE;
}
diff --git a/gcc/testsuite/gcc.target/aarch64/copysign-pr118892.c b/gcc/testsuite/gcc.target/aarch64/copysign-pr118892.c
new file mode 100644
index 00000000000..adfa30dc3e2
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/copysign-pr118892.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-Ofast" } */
+
+double l();
+double f()
+{
+ double t6[2] = {l(), l()};
+ double t7[2];
+ __builtin_memcpy(&t7, &t6, sizeof(t6));
+ return -__builtin_fabs(t7[1]);
+}
--
2.50.1

View File

@ -11,7 +11,7 @@ BuildRequires: scl-utils-build
%global gcc_major 14
# Note, gcc_release must be integer, if you want to add suffixes to
# %%{release}, append them after %%{gcc_release} on Release: line.
%global gcc_release 7
%global gcc_release 11
%global nvptx_tools_gitrev 87ce9dc5999e5fca2e1d3478a30888d9864c9804
%global newlib_cygwin_gitrev d45261f62a15f8abd94a1031020b9a9f455e4eed
%global isl_version 0.24
@ -152,7 +152,7 @@ BuildRequires: scl-utils-build
Summary: GCC version %{gcc_major}
Name: %{?scl_prefix}gcc
Version: %{gcc_version}
Release: %{gcc_release}.1%{?dist}
Release: %{gcc_release}%{?dist}
# License notes for some of the less obvious ones:
# gcc/doc/cppinternals.texi: Linux-man-pages-copyleft-2-para
# isl: MIT, BSD-2-Clause
@ -361,6 +361,11 @@ Patch3015: 0018-Use-CXX11-ABI.patch
Patch3017: 0020-more-fixes.patch
Patch3018: 0021-libstdc++-disable-tests.patch
Patch4000: gcc14-RHEL-90244.patch
Patch4001: gcc14-pr118892-1.patch
Patch4002: gcc14-pr118892-2.patch
Patch4003: gcc14-pr118892-3.patch
%if 0%{?rhel} == 9
%global nonsharedver 110
%endif
@ -724,6 +729,12 @@ touch -r isl-0.24/m4/ax_prog_cxx_for_build.m4 isl-0.24/m4/ax_prog_cc_for_build.m
%patch -P3017 -p1 -b .dts-test-17~
%patch -P3018 -p1 -b .dts-test-18~
# Bugfix backports.
%patch -P4000 -p1 -b .RHEL-90244~
%patch -P4001 -p1 -b .RHEL-pr118892-1~
%patch -P4002 -p1 -b .RHEL-pr118892-2~
%patch -P4003 -p1 -b .RHEL-pr118892-3~
find gcc/testsuite -name \*.pr96939~ | xargs rm -f
echo 'Red Hat %{version}-%{gcc_release}' > gcc/DEV-PHASE
@ -1036,20 +1047,6 @@ make %{?_smp_mflags} BOOT_CFLAGS="$OPT_FLAGS" LDFLAGS_FOR_TARGET=-Wl,-z,relro,-z
make %{?_smp_mflags} BOOT_CFLAGS="$OPT_FLAGS" LDFLAGS_FOR_TARGET=-Wl,-z,relro,-z,now profiledbootstrap
%endif
echo '/* GNU ld script
Use the shared library, but some functions are only in
the static library, so try that secondarily. */
%{oformat}
INPUT ( %{?scl:%{_root_prefix}}%{!?scl:%{_prefix}}/%{_lib}/libstdc++.so.6 -lstdc++_nonshared%{nonsharedver} )' \
> %{gcc_target_platform}/libstdc++-v3/src/.libs/libstdc++_system.so
%if 0
# Relink libcc1 against -lstdc++_nonshared:
sed -i -e '/^postdeps/s/-lstdc++/-lstdc++_system/' libcc1/libtool
rm -f libcc1/libcc1.la
make -C libcc1 libcc1.la
%endif
CC="`%{gcc_target_platform}/libstdc++-v3/scripts/testsuite_flags --build-cc`"
CXX="`%{gcc_target_platform}/libstdc++-v3/scripts/testsuite_flags --build-cxx` `%{gcc_target_platform}/libstdc++-v3/scripts/testsuite_flags --build-includes`"
@ -1431,11 +1428,18 @@ echo '/* GNU ld script */
%{oformat}
INPUT ( %{?scl:%{_root_prefix}}%{!?scl:%{_prefix}}/%{_lib}/libgomp.so.1 )' > libgomp.so
%define libstdcxx_so %{?scl:%{_root_prefix}}%{!?scl:%{_prefix}}/%{_lib}/libstdc++.so.6
%define libstdcxx_so_link INPUT ( %{libstdcxx_so} -lstdc++_nonshared AS_NEEDED (%{libstdcxx_so}) )
%define libstdcxx64_so %{?scl:%{_root_prefix}}%{!?scl:%{_prefix}}/lib64/libstdc++.so.6
%define libstdcxx64_so_link INPUT ( %{libstdcxx64_so} -lstdc++_nonshared AS_NEEDED (%{libstdcxx64_so}) )
%define libstdcxx32_so %{?scl:%{_root_prefix}}%{!?scl:%{_prefix}}/lib/libstdc++.so.6
%define libstdcxx32_so_link INPUT ( %{libstdcxx32_so} -lstdc++_nonshared AS_NEEDED (%{libstdcxx32_so}) )
echo '/* GNU ld script
Use the shared library, but some functions are only in
the static library, so try that secondarily. */
%{oformat}
INPUT ( %{?scl:%{_root_prefix}}%{!?scl:%{_prefix}}/%{_lib}/libstdc++.so.6 -lstdc++_nonshared )' > libstdc++.so
%{libstdcxx_so_link}' > libstdc++.so
rm -f libgfortran.so
echo '/* GNU ld script
Use the shared library, but some functions are only in
@ -1531,7 +1535,7 @@ echo '/* GNU ld script
Use the shared library, but some functions are only in
the static library, so try that secondarily. */
%{oformat2}
INPUT ( %{?scl:%{_root_prefix}}%{!?scl:%{_prefix}}/lib64/libstdc++.so.6 -lstdc++_nonshared )' > 64/libstdc++.so
%{libstdcxx64_so_link}' > 64/libstdc++.so
rm -f 64/libgfortran.so
echo '/* GNU ld script
Use the shared library, but some functions are only in
@ -1619,7 +1623,7 @@ echo '/* GNU ld script
Use the shared library, but some functions are only in
the static library, so try that secondarily. */
%{oformat2}
INPUT ( %{?scl:%{_root_prefix}}%{!?scl:%{_prefix}}/lib/libstdc++.so.6 -lstdc++_nonshared )' > 32/libstdc++.so
%{libstdcxx32_so_link}' > 32/libstdc++.so
rm -f 32/libgfortran.so
echo '/* GNU ld script
Use the shared library, but some functions are only in
@ -1919,7 +1923,7 @@ echo '/* GNU ld script
Use the shared library, but some functions are only in
the static library, so try that secondarily. */
%{oformat}
INPUT ( %{?scl:%{_root_prefix}}%{!?scl:%{_prefix}}/%{_lib}/libstdc++.so.6 -lstdc++_nonshared )' \
%{libstdcxx_so_link}' \
> %{gcc_target_platform}/libstdc++-v3/src/.libs/libstdc++.so
cp -a %{gcc_target_platform}/libstdc++-v3/src/.libs/libstdc++_nonshared%{nonsharedver}.a \
%{gcc_target_platform}/libstdc++-v3/src/.libs/libstdc++_nonshared.a
@ -2796,6 +2800,19 @@ fi
%endif
%changelog
* Wed Aug 27 2025 Siddhesh Poyarekar <siddhesh@redhat.com> 14.2.1-11
- Fix ICE in rebuild_jump_labels on aarch64-linux-gnu (RHEL-106790)
* Wed May 28 2025 Siddhesh Poyarekar <siddhesh@redhat.com> 14.2.1-10
- Put the libstdc++ AS_NEEDED in the right places (RHEL-84679)
* Thu May 22 2025 Siddhesh Poyarekar <siddhesh@redhat.com> 14.2.1-9
- Add AS_NEEDED libstdc++.so.6 when only needed through libstdc++_nonshared
(RHEL-84679)
* Thu May 22 2025 Siddhesh Poyarekar <siddhesh@redhat.com> 14.2.1-8
- libstdc++: Fix -Warray-bounds warning in std::vector<bool> (RHEL-90244)
* Fri Feb 7 2025 Marek Polacek <polacek@redhat.com> 14.2.1-7.1
- disable jQuery use, don't ship jquery.js (CVE-2020-11023, RHEL-78387)