From 070eb579eeebac87e575cf853556670c71b5e24a Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Fri, 19 Jul 2024 18:45:27 -0400 Subject: [PATCH] 11.5.0-1 Update from releases/gcc-11 branch Resolves: RHEL-35635 --- .gitignore | 1 + gcc.spec | 60 +++++++++++++++++-- gcc11-libgfortran-flush.patch | 51 ++++++++++++++++ gcc11-libstdc++-docs.patch | 4 +- gcc11-pr113960.patch | 107 ++++++++++++++++++++++++++++++++++ sources | 1 + update-gcc.sh | 37 ++++++++++-- 7 files changed, 251 insertions(+), 10 deletions(-) create mode 100644 gcc11-libgfortran-flush.patch create mode 100644 gcc11-pr113960.patch diff --git a/.gitignore b/.gitignore index 0597b3c..e89cc95 100644 --- a/.gitignore +++ b/.gitignore @@ -48,3 +48,4 @@ /gcc-11.3.1-20221121.tar.xz /gcc-11.4.1-20230605.tar.xz /gcc-11.4.1-20231218.tar.xz +/gcc-11.5.0-20240719.tar.xz diff --git a/gcc.spec b/gcc.spec index 16cfbb6..7b5b9d9 100644 --- a/gcc.spec +++ b/gcc.spec @@ -1,10 +1,10 @@ -%global DATE 20231218 -%global gitrev 9e6808abff4d96f3f09474a2a744ef5f56df3e28 -%global gcc_version 11.4.1 +%global DATE 20240719 +%global gitrev a985e3068a6f8045f8a6f2d2d5ae75f5eb0a8767 +%global gcc_version 11.5.0 %global gcc_major 11 # 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 3 +%global gcc_release 1 %global nvptx_tools_gitrev 5f6f343a302d620b0868edab376c00b15741e39e %global newlib_cygwin_gitrev 50e2a63b04bdd018484605fbb954fd1bd5147fa0 %global _unpackaged_files_terminate_build 0 @@ -295,6 +295,8 @@ Patch32: gcc11-testsuite-fixes-2.patch Patch33: gcc11-pr111039.patch Patch34: gcc11-pr111070.patch Patch35: gcc11-testsuite-aarch64-add-fno-stack-protector.patch +Patch36: gcc11-libgfortran-flush.patch +Patch37: gcc11-pr113960.patch Patch100: gcc11-fortran-fdec-duplicates.patch Patch101: gcc11-fortran-flogical-as-integer.patch @@ -895,6 +897,8 @@ mark them as cross compiled. %patch33 -p1 -b .pr111039~ %patch34 -p1 -b .pr111070~ %patch35 -p1 -b .testsuite3~ +%patch36 -p1 -b .libgfortran-flush~ +%patch37 -p1 -b .pr113960~ %if 0%{?rhel} >= 9 %patch100 -p1 -b .fortran-fdec-duplicates~ @@ -3588,6 +3592,54 @@ end %endif %changelog +* Fri Jul 19 2024 Marek Polacek 11.5.0-1 +- update from releases/gcc-11 branch (RHEL-35635) + - GCC 11.5 release + - PRs ada/113893, ada/113979, analyzer/104042, c/113262, c/114007, c/114493, + c++/89224, c++/92145, c++/92407, c++/97990, c++/99710, c++/100667, + c++/100772, c++/101765, c++/103185, c++/104051, c++/111485, + c++/111529, c++/113598, c++/113674, c++/114537, c++/114561, + c++/114562, c++/114572, c++/114634, c++/114691, d/113125, d/113758, + d/114171, debug/111080, debug/112718, driver/115440, fortran/50410, + fortran/103715, fortran/104908, fortran/107426, fortran/114474, + fortran/114825, gcov-profile/114115, libfortran/110651, + libgomp/113192, libquadmath/114533, libstdc++/104259, + libstdc++/104606, libstdc++/105417, libstdc++/110054, + libstdc++/113250, libstdc++/114147, libstdc++/114401, + libstdc++/114750, libstdc++/114803, libstdc++/115269, + libstdc++/115454, libstdc++/115575, middle-end/90348, + middle-end/95351, middle-end/107385, middle-end/108789, + middle-end/110027, middle-end/110115, middle-end/110176, + middle-end/111422, middle-end/111632, middle-end/112732, + middle-end/113907, middle-end/113921, middle-end/114599, + middle-end/114734, middle-end/114753, middle-end/115527, + middle-end/115836, objc/101666, objc/101718, preprocessor/105608, + rtl-optimization/100303, rtl-optimization/108086, + rtl-optimization/110079, rtl-optimization/114768, + rtl-optimization/114902, rtl-optimization/115092, sanitizer/97696, + sanitizer/111736, sanitizer/114956, sanitizer/115172, target/88309, + target/101737, target/101865, target/105522, target/108120, + target/108743, target/110411, target/111610, target/111677, + target/112397, target/113122, target/113281, target/114049, + target/114098, target/114130, target/114184, target/114310, + target/114837, target/114846, target/115253, target/115297, + target/115360, target/115457, target/115475, target/115611, + target/115691, testsuite/113175, testsuite/114034, testsuite/114036, + tree-optimization/110386, tree-optimization/110422, + tree-optimization/111039, tree-optimization/111070, + tree-optimization/111331, tree-optimization/111407, + tree-optimization/111445, tree-optimization/111736, + tree-optimization/112495, tree-optimization/112505, + tree-optimization/112793, tree-optimization/113372, + tree-optimization/113552, tree-optimization/113603, + tree-optimization/114027, tree-optimization/114115, + tree-optimization/114566, tree-optimization/114876, + tree-optimization/115192, tree-optimization/115337, + tree-optimization/115843 +- fix FLUSH IOSTAT value (PR libfortran/101255, RHEL-32536) +- fix conditions for using memcmp in + std::lexicographical_compare_three_way (PR libstdc++/113960) + * Mon Dec 18 2023 Marek Polacek 11.4.1-3 - update from releases/gcc-11-branch (RHEL-17638) - PRs c++/106310, c++/106890, c++/109666, c++/109761, c++/111357, diff --git a/gcc11-libgfortran-flush.patch b/gcc11-libgfortran-flush.patch new file mode 100644 index 0000000..8e3016a --- /dev/null +++ b/gcc11-libgfortran-flush.patch @@ -0,0 +1,51 @@ +commit c14f38d4292ec22462a4080841d526f87428130a +Author: Francois-Xavier Coudert +Date: Thu Dec 16 15:33:17 2021 +0100 + + Fix FLUSH IOSTAT value + + PR libfortran/101255 + + libgfortran/ChangeLog: + + * io/file_pos.c: Fix error code. + + gcc/testsuite/ChangeLog: + + * gfortran.dg/iostat_5.f90: New file. + +diff --git a/gcc/testsuite/gfortran.dg/iostat_5.f90 b/gcc/testsuite/gfortran.dg/iostat_5.f90 +new file mode 100644 +index 00000000000..1e72dfdf7e1 +--- /dev/null ++++ b/gcc/testsuite/gfortran.dg/iostat_5.f90 +@@ -0,0 +1,16 @@ ++! PR libfortran/101255 ++! { dg-do run } ++ ++program test ++ use ISO_FORTRAN_ENV, only: IOSTAT_EOR, IOSTAT_END ++ implicit none ++ character(len=50) :: err ++ integer :: i ++ ++ err = "" ++ flush(99, iostat=i, iomsg=err) ++ ++ if (err == "") stop 1 ++ if (i >= 0) stop 2 ++ if (i == IOSTAT_EOR .or. i == IOSTAT_END) stop 3 ++end +diff --git a/libgfortran/io/file_pos.c b/libgfortran/io/file_pos.c +index 7e71ca577e0..4ed1698f17a 100644 +--- a/libgfortran/io/file_pos.c ++++ b/libgfortran/io/file_pos.c +@@ -527,7 +527,7 @@ st_flush (st_parameter_filepos *fpp) + } + else + /* FLUSH on unconnected unit is illegal: F95 std., 9.3.5. */ +- generate_error (&fpp->common, LIBERROR_BAD_OPTION, ++ generate_error (&fpp->common, -LIBERROR_BAD_UNIT, + "Specified UNIT in FLUSH is not connected"); + + if (needs_unlock) diff --git a/gcc11-libstdc++-docs.patch b/gcc11-libstdc++-docs.patch index 353ab27..b0f7deb 100644 --- a/gcc11-libstdc++-docs.patch +++ b/gcc11-libstdc++-docs.patch @@ -4,7 +4,7 @@ FSF

-+ Release 11.4.1 ++ Release 11.5.0 +

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation @@ -17,7 +17,7 @@

- The API documentation, rendered into HTML, can be viewed online + The API documentation, rendered into HTML, can be viewed locally -+ for the 11.4.1 release, ++ for the 11.5.0 release, + online for each GCC release and diff --git a/gcc11-pr113960.patch b/gcc11-pr113960.patch new file mode 100644 index 0000000..b9ca081 --- /dev/null +++ b/gcc11-pr113960.patch @@ -0,0 +1,107 @@ +commit 6f5dcea85a31845ec6f4b6886734b0f02e013718 +Author: Jonathan Wakely +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 +- concept __is_byte_iter = contiguous_iterator<_Iter> +- && __is_memcmp_ordered>::__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 ++ concept __memcmp_ordered_with ++ = (__is_memcmp_ordered_with, ++ 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; ++ } + #endif // is_constant_evaluated + 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 ++#include ++ ++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 ); ++} diff --git a/sources b/sources index fdcc833..74ffa84 100644 --- a/sources +++ b/sources @@ -2,3 +2,4 @@ SHA512 (gcc-11.4.1-20231218.tar.xz) = cf8b715da6379300e91f5460162a5b6dc60aa29e20 SHA512 (isl-0.18.tar.bz2) = 85d0b40f4dbf14cb99d17aa07048cdcab2dc3eb527d2fbb1e84c41b2de5f351025370e57448b63b2b8a8cf8a0843a089c3263f9baee1542d5c2e1cb37ed39d94 SHA512 (newlib-cygwin-50e2a63b04bdd018484605fbb954fd1bd5147fa0.tar.xz) = 002a48a7b689a81abbf16161bcaec001a842e67dfbe372e9e109092703bfc666675f16198f60ca429370e8850d564547dc505df81bc3aaca4ce6defbc014ad6c SHA512 (nvptx-tools-5f6f343a302d620b0868edab376c00b15741e39e.tar.xz) = f6d10db94fa1570ae0f94df073fa3c73c8e5ee16d59070b53d94f7db0de8a031bc44d7f3f1852533da04b625ce758e022263855ed43cfc6867e0708d001e53c7 +SHA512 (gcc-11.5.0-20240719.tar.xz) = 8996ff2aaad765521303f0bde46e4c53992de266062ceabaef0b311ef68be6068e9b0002a57c036d898a6d58735f4d1884e6a7a152c567f941adb200d076fcd4 diff --git a/update-gcc.sh b/update-gcc.sh index bacec6a..93160c9 100755 --- a/update-gcc.sh +++ b/update-gcc.sh @@ -1,7 +1,36 @@ #!/bin/sh -[ -d gcc-dir.tmp ] && echo gcc-dir.tmp already exists && exit 1 -git clone --depth 1 git://gcc.gnu.org/git/gcc.git gcc-dir.tmp -git --git-dir=gcc-dir.tmp/.git fetch --depth 1 origin $1 +if [ "$#" -eq 0 ]; then + echo "Usage: ./update-gcc.sh gcc/redhat/heads/gcc-NN-branch_commit_hash [git_reference_dir_to_speed_up]" + exit 1 +fi +export LC_ALL=C +if ! [ -f gcc.spec ]; then echo Must be run in the directory with gcc.spec file.; exit 1; fi +if [ -d gcc-dir.tmp ]; then echo gcc-dir.tmp already exists.; exit 1; fi +v=`sed -n 's/^%global gcc_version //p' gcc.spec` +p=`sed -n 's/^%global gitrev //p' gcc.spec` +h=$1 +if [ "$#" -ge 2 ]; then + git clone --dissociate --reference $2 git://gcc.gnu.org/git/gcc.git gcc-dir.tmp +else + git clone git://gcc.gnu.org/git/gcc.git gcc-dir.tmp +fi +git --git-dir=gcc-dir.tmp/.git fetch origin $h d=`date --iso | sed 's/-//g'` -git --git-dir=gcc-dir.tmp/.git archive --prefix=gcc-11.3.1-$d/ $1 | xz -9e > gcc-11.3.1-$d.tar.xz +cd gcc-dir.tmp +git diff $p..$h > P1 +git log --format=%B `git log --format='%ae %H' $p..$h | awk '/^gccadmin@gcc.gnu.org/{print $2;exit 0}'`..$h > P2 +diff -up /dev/null P2 >> P1 +sed -n 's,^+[[:blank:]]\+PR \([a-z0-9+-]\+/[0-9]\+\)$,\1,p' P1 | sed 's/ - .*$//;s/[: ;.]//g' | LC_ALL=C sort -u -t / -k 1,1 -k 2,2n > P3 +> P4 +for i in `cat P3`; do if grep -F $i ../gcc.spec >/dev/null; then echo $i already recorded.; else echo $i >> P4; fi; done +case "$v" in + *.0.*) echo "- update from trunk" > P5;; + *) echo "- update from releases/gcc-`echo $v | sed 's/\..*$//'` branch" > P5;; +esac +echo `cat P4` | sed 's/ /, /g' | fold -w 71 -s | sed '1s/^/ - PRs /;2,$s/^/ /;s/, $/,/' >> P5 +echo >> P5 +cd .. +sed -i -e '/^%global gitrev /s/ [0-9a-f]\+$/ '$h'/;/^%global DATE /s/ [0-9]\+$/ '$d'/;/^%changelog$/r gcc-dir.tmp/P5' gcc.spec +git --git-dir=gcc-dir.tmp/.git archive --prefix=gcc-$v-$d/ $h | xz -9e > gcc-$v-$d.tar.xz rm -rf gcc-dir.tmp +fedpkg new-sources gcc-$v-$d.tar.xz `sed 's/SHA512 (\(.*\)) = [0-9a-f]\+$/\1/' sources | grep -v '^gcc-'`