Compare commits

...

No commits in common. "c8-beta" and "c9" have entirely different histories.
c8-beta ... c9

3 changed files with 137 additions and 17 deletions

View File

@ -10365,7 +10365,7 @@
+//asm (".hidden _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_assignERKS4_");
+asm (".hidden _ZNSt7__cxx1112basic_stringIwSt11char_traitsIwESaIwEE10_M_disposeEv");
+//asm (".hidden _ZNSt7__cxx1112basic_stringIwSt11char_traitsIwESaIwEE9_M_assignERKS4_");
+#if defined(__i386__) || (defined(__powerpc__) && !defined(__powerpc64__))
+#if defined(__powerpc__) && !defined(__powerpc64__)
+asm (".hidden _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_mutateEjjPKcj");
+asm (".hidden _ZNSt7__cxx1112basic_stringIwSt11char_traitsIwESaIwEE9_M_mutateEjjPKwj");
+#endif

View File

@ -0,0 +1,107 @@
commit 6f5dcea85a31845ec6f4b6886734b0f02e013718
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Tue Feb 27 17:50:34 2024 +0000
libstdc++: Fix conditions for using memcmp in std::lexicographical_compare_three_way [PR113960]
The change in r11-2981-g2f983fa69005b6 meant that
std::lexicographical_compare_three_way started to use memcmp for
unsigned integers on big endian targets, but for that to be valid we
need the two value types to have the same size and we need to use that
size to compute the length passed to memcmp.
I already defined a __is_memcmp_ordered_with trait that does the right
checks, std::lexicographical_compare_three_way just needs to use it.
libstdc++-v3/ChangeLog:
PR libstdc++/113960
* include/bits/stl_algobase.h (__is_byte_iter): Replace with ...
(__memcmp_ordered_with): New concept.
(lexicographical_compare_three_way): Use __memcmp_ordered_with
instead of __is_byte_iter. Use correct length for memcmp.
* testsuite/25_algorithms/lexicographical_compare_three_way/113960.cc:
New test.
(cherry picked from commit f5cdda8acb06c20335855ed353ab9a441c12128a)
diff --git a/libstdc++-v3/include/bits/stl_algobase.h b/libstdc++-v3/include/bits/stl_algobase.h
index 7664301a208..6e648e48ad0 100644
--- a/libstdc++-v3/include/bits/stl_algobase.h
+++ b/libstdc++-v3/include/bits/stl_algobase.h
@@ -1780,11 +1780,14 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
}
#if __cpp_lib_three_way_comparison
- // Iter points to a contiguous range of unsigned narrow character type
- // or std::byte, suitable for comparison by memcmp.
- template<typename _Iter>
- concept __is_byte_iter = contiguous_iterator<_Iter>
- && __is_memcmp_ordered<iter_value_t<_Iter>>::__value;
+ // Both iterators refer to contiguous ranges of unsigned narrow characters,
+ // or std::byte, or big-endian unsigned integers, suitable for comparison
+ // using memcmp.
+ template<typename _Iter1, typename _Iter2>
+ concept __memcmp_ordered_with
+ = (__is_memcmp_ordered_with<iter_value_t<_Iter1>,
+ iter_value_t<_Iter2>>::__value)
+ && contiguous_iterator<_Iter1> && contiguous_iterator<_Iter2>;
// Return a struct with two members, initialized to the smaller of x and y
// (or x if they compare equal) and the result of the comparison x <=> y.
@@ -1834,20 +1837,20 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
if (!std::__is_constant_evaluated())
if constexpr (same_as<_Comp, __detail::_Synth3way>
|| same_as<_Comp, compare_three_way>)
- if constexpr (__is_byte_iter<_InputIter1>)
- if constexpr (__is_byte_iter<_InputIter2>)
- {
- const auto [__len, __lencmp] = _GLIBCXX_STD_A::
- __min_cmp(__last1 - __first1, __last2 - __first2);
- if (__len)
- {
- const auto __c
- = __builtin_memcmp(&*__first1, &*__first2, __len) <=> 0;
- if (__c != 0)
- return __c;
- }
- return __lencmp;
- }
+ if constexpr (__memcmp_ordered_with<_InputIter1, _InputIter2>)
+ {
+ const auto [__len, __lencmp] = _GLIBCXX_STD_A::
+ __min_cmp(__last1 - __first1, __last2 - __first2);
+ if (__len)
+ {
+ const auto __blen = __len * sizeof(*__first1);
+ const auto __c
+ = __builtin_memcmp(&*__first1, &*__first2, __blen) <=> 0;
+ if (__c != 0)
+ return __c;
+ }
+ return __lencmp;
+ }
while (__first1 != __last1)
{
diff --git a/libstdc++-v3/testsuite/25_algorithms/lexicographical_compare_three_way/113960.cc b/libstdc++-v3/testsuite/25_algorithms/lexicographical_compare_three_way/113960.cc
new file mode 100644
index 00000000000..d51ae1a3d50
--- /dev/null
+++ b/libstdc++-v3/testsuite/25_algorithms/lexicographical_compare_three_way/113960.cc
@@ -0,0 +1,15 @@
+// { dg-do run { target c++20 } }
+
+// PR libstdc++/113960
+// std::map with std::vector as input overwrites itself with c++20, on s390x
+
+#include <algorithm>
+#include <testsuite_hooks.h>
+
+int main()
+{
+ unsigned short a1[] { 1, 2, 3 };
+ unsigned short a2[] { 1, 2, 4 };
+ // Incorrect memcmp comparison for big endian targets.
+ VERIFY( std::lexicographical_compare_three_way(a1, a1+3, a2, a2+3) < 0 );
+}

View File

@ -147,7 +147,7 @@
Summary: GCC version 12
Name: %{?scl_prefix}gcc
Version: %{gcc_version}
Release: %{gcc_release}.4%{?dist}
Release: %{gcc_release}.6%{?dist}
# libgcc, libgfortran, libgomp, libstdc++ and crtstuff have
# GCC Runtime Exception.
License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ with exceptions and LGPLv2+ and BSD
@ -193,10 +193,8 @@ URL: http://gcc.gnu.org
# Need binutils which support -plugin
# Need binutils which support .loc view >= 2.30
# Need binutils which support --generate-missing-build-notes=yes >= 2.31
%if 0%{?scl:1}
BuildRequires: %{?scl_prefix}binutils >= 2.31
BuildRequires: %{?scl_prefix}gdb >= 7.4.50
%endif
# While gcc doesn't include statically linked binaries, during testing
# -static is used several times.
BuildRequires: glibc-static
@ -351,6 +349,7 @@ Patch11: gcc12-d-shared-libphobos.patch
Patch12: gcc12-pr107468.patch
Patch15: gcc12-static-libquadmath.patch
Patch16: gcc12-FMA-chains.patch
Patch17: gcc12-pr113960.patch
Patch100: gcc12-fortran-fdec-duplicates.patch
Patch101: gcc12-fortran-flogical-as-integer.patch
@ -731,6 +730,7 @@ so that there cannot be any synchronization problems.
%patch12 -p0 -b .pr107468~
%patch15 -p0 -b .static-libquadmath~
%patch16 -p1 -b .fma~
%patch17 -p1 -b .pr113960~
%if 0%{?rhel} >= 6
%patch100 -p1 -b .fortran-fdec-duplicates~
@ -2990,40 +2990,47 @@ fi
%endif
%changelog
* Wed Apr 3 2024 Marek Polacek <polacek@redhat.com> 12.2.1-7.6
- bump NVR (RHEL-30832)
* Thu Mar 28 2024 Marek Polacek <polacek@redhat.com> 12.2.1-7.5
- fix conditions for using memcmp in
std::lexicographical_compare_three_way (PR libstdc++/113960, RHEL-30832)
* Fri Feb 10 2023 Marek Polacek <polacek@redhat.com> 12.2.1-7.4
- avoid fma_chain for -march=alderlake and sapphirerapids (#2168917)
- avoid fma_chain for -march=alderlake and sapphirerapids (#2168919)
* Wed Jan 25 2023 Marek Polacek <polacek@redhat.com> 12.2.1-7.3
- provide libexec/ symlinks on all RHELs (#2162498)
- provide libexec/ symlinks on all RHELs (#2164262)
* Wed Jan 11 2023 Marek Polacek <polacek@redhat.com> 12.2.1-7.2
- build libisl.so with -g (#2155127)
- build libisl.so with -g (#2154936)
* Tue Dec 20 2022 Marek Polacek <polacek@redhat.com> 12.2.1-6.1
- apply an ISL patch (#2155127)
- apply an ISL patch (#2154936)
* Wed Dec 14 2022 Nick Clifton <nickc@redhat.com> 12.2.1-6
- Fixed run-time requirement for annobin plugin. (#2151927)
* Tue Dec 13 2022 Nick Clifton <nickc@redhat.com> 12.2.1-5
- Build the annobin plugin. Call it gts-gcc-annobin.so. (#2151926)
- Build the annobin plugin. Call it gts-gcc-annobin.so. (#2151927)
* Wed Nov 23 2022 Marek Polacek <polacek@redhat.com> 12.2.1-4
- update from releases/gcc-12 branch (#2110582)
* Wed Nov 30 2022 Marek Polacek <polacek@redhat.com> 12.2.1-4
- update from releases/gcc-12 branch (#2110583)
- fix up std::from_chars behavior in rounding modes other than FE_TONEAREST
(PR libstdc++/107468)
* Tue Oct 18 2022 Marek Polacek <polacek@redhat.com> 12.1.1-3.4
* Wed Nov 30 2022 Marek Polacek <polacek@redhat.com> 12.1.1-3.4
- fix pr86731-fwrapv-longlong.c (#2134379)
* Fri Oct 7 2022 Marek Polacek <polacek@redhat.com> 12.1.1-3.3
- add -static-libquadmath (#2131081)
* Wed Nov 30 2022 Marek Polacek <polacek@redhat.com> 12.1.1-3.3
- add -static-libquadmath (#2131082)
* Fri Jul 8 2022 Marek Polacek <polacek@redhat.com> 12.1.1-3.2
- recognize PLUS and XOR forms of rldimi (PR target/105991, #2095789)
* Fri Jul 8 2022 Marek Polacek <polacek@redhat.com> 12.1.1-3.1
- always ship liblsan on s390x (#2104829)
- always ship liblsan on s390x (#2104824)
* Wed Jul 6 2022 Marek Polacek <polacek@redhat.com> 12.1.1-3
- update from releases/gcc-12 branch
@ -3052,12 +3059,18 @@ fi
- fix up libtsan on s390x
- fix nvptx build (PRs bootstrap/105551, target/105938)
* Tue Jun 28 2022 Marek Polacek <polacek@redhat.com> 12.1.1-1.4
* Tue Jun 28 2022 Marek Polacek <polacek@redhat.com> 12.1.1-1.6
- ship lto-dump (#2101835)
* Thu Jun 23 2022 Marek Polacek <polacek@redhat.com> 12.1.1-1.3
* Fri Jun 24 2022 Marek Polacek <polacek@redhat.com> 12.1.1-1.5
- use gcc-toolset-12-binutils
* Wed Jun 22 2022 Marek Polacek <polacek@redhat.com> 12.1.1-1.4
- don't provide g++/fortran (CS-1145)
* Fri Jun 17 2022 Marek Polacek <polacek@redhat.com> 12.1.1-1.3
- require system binutils
* Wed Jun 1 2022 Marek Polacek <polacek@redhat.com> 12.1.1-1.2
- don't skip testing on s390x