- backport from 11.5.0-2: fix TARGET_CPU_DEFAULT (PR target/105157, RHEL-50037)

- backport from 11.5.0-2: libstdc++: Workaround kernel-headers on s390x-linux (RHEL-50054)
- backport from 11.5.0-2: fix wrong code with memcpy from _Complex (PR tree-optimization/116034)
- backport from 11.5.0-1: update from releases/gcc-11 branch (RHEL-35635)
  - GCC 11.5 release
- backport from 11.5.0-1: fix FLUSH IOSTAT value (PR libfortran/101255, RHEL-32536)
- backport from 11.5.0-1: fix conditions for using memcmp in std::lexicographical_compare_three_way (PR libstdc++/113960)
- backport from 11.4.1-3: update from releases/gcc-11-branch (RHEL-17638)
- backport from 11.4.1-3: use -fno-stack-protector in some aarch64 tests
epel9 imports/epel9/gcc-epel-11.5.0-2.el9
Robert Scheck 4 weeks ago
parent 588511b135
commit e713138f26

@ -1,10 +1,10 @@
%global DATE 20230605
%global gitrev 2c7f17ca0b642790d74cca6c798196e9053a4bcf
%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 4
%global gcc_release 2
%global nvptx_tools_gitrev 5f6f343a302d620b0868edab376c00b15741e39e
%global newlib_cygwin_gitrev 50e2a63b04bdd018484605fbb954fd1bd5147fa0
%global _unpackaged_files_terminate_build 0
@ -128,7 +128,7 @@
# TODO: Add ppc64le-redhat-linux s390x-redhat-linux later.
%global cross_targets aarch64-redhat-linux
# Override RHEL/derivative build options for gcc-epel
%global epel_bootstrap 0
%global epel_bootstrap 1
%global epel_glibc32 0
%global build_ada 1
%global build_objc 1
@ -344,11 +344,13 @@ Patch27: gcc11-s390x-regarg-1.patch
Patch28: gcc11-s390x-regarg-2.patch
Patch29: gcc11-s390x-regarg-3.patch
Patch30: gcc11-testsuite-fixes.patch
Patch31: gcc11-pr96024.patch
Patch32: gcc11-testsuite-fixes-2.patch
Patch33: gcc11-pr111039.patch
Patch34: gcc11-pr111070.patch
Patch35: gcc11-pr106310.patch
Patch33: gcc11-testsuite-fixes-3.patch
Patch34: gcc11-pr116034.patch
Patch35: gcc11-testsuite-aarch64-add-fno-stack-protector.patch
Patch36: gcc11-libgfortran-flush.patch
Patch37: gcc11-pr113960.patch
Patch38: gcc11-pr105157.patch
Patch100: gcc11-fortran-fdec-duplicates.patch
Patch101: gcc11-fortran-flogical-as-integer.patch
@ -968,11 +970,13 @@ mark them as cross compiled.
%patch28 -p1 -b .s390x-regarg-2~
%patch29 -p1 -b .s390x-regarg-3~
%patch30 -p1 -b .testsuite~
%patch31 -p1 -b .pr96024~
%patch32 -p1 -b .testsuite2~
%patch33 -p1 -b .pr111039~
%patch34 -p1 -b .pr111070~
%patch35 -p1 -b .pr106310~
%patch33 -p1 -b .testsuite3~
%patch34 -p1 -b .pr116034~
%patch35 -p1 -b .testsuite4~
%patch36 -p1 -b .libgfortran-flush~
%patch37 -p1 -b .pr113960~
%patch38 -p1 -b .pr105157~
%if 0%{?rhel} >= 9
%patch100 -p1 -b .fortran-fdec-duplicates~
@ -3789,6 +3793,18 @@ end
%endif
%changelog
* Thu Nov 28 2024 Robert Scheck <robert@fedoraproject.org> 11.5.0-2
- backport from 11.5.0-2: fix TARGET_CPU_DEFAULT (PR target/105157, RHEL-50037)
- backport from 11.5.0-2: libstdc++: Workaround kernel-headers on s390x-linux (RHEL-50054)
- backport from 11.5.0-2: fix wrong code with memcpy from _Complex (PR tree-optimization/116034)
- backport from 11.5.0-1: update from releases/gcc-11 branch (RHEL-35635)
- GCC 11.5 release
- backport from 11.5.0-1: fix FLUSH IOSTAT value (PR libfortran/101255, RHEL-32536)
- backport from 11.5.0-1: fix conditions for using memcmp in
std::lexicographical_compare_three_way (PR libstdc++/113960)
- backport from 11.4.1-3: update from releases/gcc-11-branch (RHEL-17638)
- backport from 11.4.1-3: use -fno-stack-protector in some aarch64 tests
* Wed Nov 29 2023 Robert Scheck <robert@fedoraproject.org> 11.4.1-4
- disable bootstrap mode and rebuild using gcc-epel-11.4.1-3.el9

@ -0,0 +1,51 @@
commit c14f38d4292ec22462a4080841d526f87428130a
Author: Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
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)

@ -4,7 +4,7 @@
<a class="link" href="https://www.fsf.org" target="_top">FSF
</a>
</p><p>
+ Release 11.4.1
+ Release 11.5.0
+ </p><p>
Permission is granted to copy, distribute and/or modify this
document under the terms of the GNU Free Documentation
@ -17,7 +17,7 @@
</p><p>
- The API documentation, rendered into HTML, can be viewed online
+ The API documentation, rendered into HTML, can be viewed locally
+ <a class="link" href="api/index.html" target="_top">for the 11.4.1 release</a>,
+ <a class="link" href="api/index.html" target="_top">for the 11.5.0 release</a>,
+ online
<a class="link" href="http://gcc.gnu.org/onlinedocs/" target="_top">for each GCC release</a>
and

@ -0,0 +1,105 @@
The original patch had
#define TARGET_CPU_NBITS 8
but I've changed it to
#define TARGET_CPU_NBITS 7
commit 5522dec054cb940fe83661b96249aa12c54c1d77
Author: Andre Vieira <andre.simoesdiasvieira@arm.com>
Date: Fri Apr 8 15:12:23 2022 +0100
aarch64: PR target/105157 Increase number of cores TARGET_CPU_DEFAULT can encode
This addresses the compile-time increase seen in the PR target/105157. This was
being caused by selecting the wrong core tuning, as when we added the latest
AArch64 the TARGET_CPU_generic tuning was pushed beyond the 0x3f mask we used
to encode both target cpu and attributes into TARGET_CPU_DEFAULT.
gcc/ChangeLog:
PR target/105157
* config.gcc: Shift ext_mask by TARGET_CPU_NBITS.
* config/aarch64/aarch64.h (TARGET_CPU_NBITS): New macro.
(TARGET_CPU_MASK): Likewise.
(TARGET_CPU_DEFAULT): Use TARGET_CPU_NBITS.
* config/aarch64/aarch64.cc (aarch64_get_tune_cpu): Use TARGET_CPU_MASK.
(aarch64_get_arch): Likewise.
(aarch64_override_options): Use TARGET_CPU_NBITS.
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -4261,7 +4261,7 @@ case "${target}" in
ext_val=`echo $ext_val | sed -e 's/[a-z0-9]\+//'`
done
- ext_mask="(("$ext_mask") << 6)"
+ ext_mask="(("$ext_mask") << TARGET_CPU_NBITS)"
if [ x"$base_id" != x ]; then
target_cpu_cname="TARGET_CPU_$base_id | $ext_mask"
fi
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -18053,6 +18053,9 @@ aarch64_validate_mtune (const char *str, const struct processor **res)
return false;
}
+static_assert (TARGET_CPU_generic < TARGET_CPU_MASK,
+ "TARGET_CPU_NBITS is big enough");
+
/* Return the CPU corresponding to the enum CPU.
If it doesn't specify a cpu, return the default. */
@@ -18062,12 +18065,12 @@ aarch64_get_tune_cpu (enum aarch64_processor cpu)
if (cpu != aarch64_none)
return &all_cores[cpu];
- /* The & 0x3f is to extract the bottom 6 bits that encode the
- default cpu as selected by the --with-cpu GCC configure option
+ /* The & TARGET_CPU_MASK is to extract the bottom TARGET_CPU_NBITS bits that
+ encode the default cpu as selected by the --with-cpu GCC configure option
in config.gcc.
???: The whole TARGET_CPU_DEFAULT and AARCH64_CPU_DEFAULT_FLAGS
flags mechanism should be reworked to make it more sane. */
- return &all_cores[TARGET_CPU_DEFAULT & 0x3f];
+ return &all_cores[TARGET_CPU_DEFAULT & TARGET_CPU_MASK];
}
/* Return the architecture corresponding to the enum ARCH.
@@ -18079,7 +18082,8 @@ aarch64_get_arch (enum aarch64_arch arch)
if (arch != aarch64_no_arch)
return &all_architectures[arch];
- const struct processor *cpu = &all_cores[TARGET_CPU_DEFAULT & 0x3f];
+ const struct processor *cpu
+ = &all_cores[TARGET_CPU_DEFAULT & TARGET_CPU_MASK];
return &all_architectures[cpu->arch];
}
@@ -18166,7 +18170,7 @@ aarch64_override_options (void)
{
/* Get default configure-time CPU. */
selected_cpu = aarch64_get_tune_cpu (aarch64_none);
- aarch64_isa_flags = TARGET_CPU_DEFAULT >> 6;
+ aarch64_isa_flags = TARGET_CPU_DEFAULT >> TARGET_CPU_NBITS;
}
if (selected_tune)
--- a/gcc/config/aarch64/aarch64.h
+++ b/gcc/config/aarch64/aarch64.h
@@ -813,10 +813,16 @@ enum target_cpus
TARGET_CPU_generic
};
+/* Define how many bits are used to represent the CPU in TARGET_CPU_DEFAULT.
+ This needs to be big enough to fit the value of TARGET_CPU_generic.
+ All bits after this are used to represent the AARCH64_CPU_DEFAULT_FLAGS. */
+#define TARGET_CPU_NBITS 7
+#define TARGET_CPU_MASK ((1 << TARGET_CPU_NBITS) - 1)
+
/* If there is no CPU defined at configure, use generic as default. */
#ifndef TARGET_CPU_DEFAULT
#define TARGET_CPU_DEFAULT \
- (TARGET_CPU_generic | (AARCH64_CPU_DEFAULT_FLAGS << 6))
+ (TARGET_CPU_generic | (AARCH64_CPU_DEFAULT_FLAGS << TARGET_CPU_NBITS))
#endif
/* If inserting NOP before a mult-accumulate insn remember to adjust the

@ -1,108 +0,0 @@
commit 506d5f399bef7f2d8c48fd83d853c6ff7811a226
Author: Jason Merrill <jason@redhat.com>
Date: Wed Jul 26 10:39:34 2023 -0400
c++: member vs global template [PR106310]
For backward compatibility we still want to allow patterns like
this->A<T>::foo, but the template keyword in a qualified name is
specifically to specify that a dependent name is a template, so don't look
in the enclosing scope at all.
Also fix handling of dependent bases: if member lookup in the current
instantiation fails and we have dependent bases, the lookup is dependent.
We were already handling that for the case where lookup in the enclosing
scope also fails, but we also want it to affect that lookup itself.
PR c++/106310
gcc/cp/ChangeLog:
* parser.c (cp_parser_template_name): Skip non-member
lookup after the template keyword.
(cp_parser_lookup_name): Pass down template_keyword_p.
gcc/testsuite/ChangeLog:
* g++.dg/template/template-keyword4.C: New test.
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 8287934a679..8df715596eb 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -2610,7 +2610,7 @@ static tree cp_parser_objc_struct_declaration
/* Utility Routines */
static cp_expr cp_parser_lookup_name
- (cp_parser *, tree, enum tag_types, bool, bool, bool, tree *, location_t);
+ (cp_parser *, tree, enum tag_types, int, bool, bool, tree *, location_t);
static tree cp_parser_lookup_name_simple
(cp_parser *, tree, location_t);
static tree cp_parser_maybe_treat_template_as_class
@@ -17748,7 +17748,7 @@ cp_parser_template_name (cp_parser* parser,
/* Look up the name. */
decl = cp_parser_lookup_name (parser, identifier,
tag_type,
- /*is_template=*/true,
+ /*is_template=*/1 + template_keyword_p,
/*is_namespace=*/false,
check_dependency_p,
/*ambiguous_decls=*/NULL,
@@ -29254,7 +29254,7 @@ prefer_type_arg (tag_types tag_type)
refer to types are ignored.
If IS_TEMPLATE is TRUE, bindings that do not refer to templates are
- ignored.
+ ignored. If IS_TEMPLATE IS 2, the 'template' keyword was specified.
If IS_NAMESPACE is TRUE, bindings that do not refer to namespaces
are ignored.
@@ -29269,7 +29269,7 @@ prefer_type_arg (tag_types tag_type)
static cp_expr
cp_parser_lookup_name (cp_parser *parser, tree name,
enum tag_types tag_type,
- bool is_template,
+ int is_template,
bool is_namespace,
bool check_dependency,
tree *ambiguous_decls,
@@ -29454,7 +29454,14 @@ cp_parser_lookup_name (cp_parser *parser, tree name,
else
decl = NULL_TREE;
- if (!decl)
+ /* If we didn't find a member and have dependent bases, the member lookup
+ is now dependent. */
+ if (!dep && !decl && any_dependent_bases_p (object_type))
+ dep = true;
+
+ if (dep && is_template == 2)
+ /* The template keyword specifies a dependent template. */;
+ else if (!decl)
/* Look it up in the enclosing context. DR 141: When looking for a
template-name after -> or ., only consider class templates. */
decl = lookup_name (name, is_namespace ? LOOK_want::NAMESPACE
diff --git a/gcc/testsuite/g++.dg/template/template-keyword4.C b/gcc/testsuite/g++.dg/template/template-keyword4.C
new file mode 100644
index 00000000000..a7ab9bb8ca6
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/template-keyword4.C
@@ -0,0 +1,18 @@
+// PR c++/106310
+
+template <class T>
+struct set{};
+
+template< typename T >
+struct Base
+{
+ template< int > int set(T const &);
+};
+
+template< typename T >
+struct Derived : Base< T >
+{
+ void f(T const &arg) {
+ this->template set< 0 >(arg);
+ }
+};

@ -1,59 +0,0 @@
commit 482551a79a3d3f107f6239679ee74655cfe8707e
Author: Richard Biener <rguenther@suse.de>
Date: Thu Aug 17 13:10:14 2023 +0200
tree-optimization/111039 - abnormals and bit test merging
The following guards the bit test merging code in if-combine against
the appearance of SSA names used in abnormal PHIs.
PR tree-optimization/111039
* tree-ssa-ifcombine.cc (ifcombine_ifandif): Check for
SSA_NAME_OCCURS_IN_ABNORMAL_PHI.
* gcc.dg/pr111039.c: New testcase.
diff --git a/gcc/testsuite/gcc.dg/pr111039.c b/gcc/testsuite/gcc.dg/pr111039.c
new file mode 100644
index 00000000000..bec9983b35f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr111039.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-O" } */
+
+int _setjmp ();
+void abcd ();
+void abcde ();
+void compiler_corruption_function(int flags)
+{
+ int nowait = flags & 1048576, isexpand = flags & 8388608;
+ abcd();
+ _setjmp(flags);
+ if (nowait && isexpand)
+ flags &= 0;
+ abcde();
+}
--- a/gcc/tree-ssa-ifcombine.c
+++ b/gcc/tree-ssa-ifcombine.c
@@ -430,6 +430,9 @@ ifcombine_ifandif (basic_block inner_cond_bb, bool inner_inv,
{
tree t, t2;
+ if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (name1))
+ return false;
+
/* Do it. */
gsi = gsi_for_stmt (inner_cond);
t = fold_build2 (LSHIFT_EXPR, TREE_TYPE (name1),
@@ -486,6 +489,10 @@ ifcombine_ifandif (basic_block inner_cond_bb, bool inner_inv,
gimple_stmt_iterator gsi;
tree t;
+ if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (name1)
+ || SSA_NAME_OCCURS_IN_ABNORMAL_PHI (name2))
+ return false;
+
/* Find the common name which is bit-tested. */
if (name1 == name2)
;

@ -1,66 +0,0 @@
commit 966b0a96523fb7adbf498ac71df5e033c70dc546
Author: Richard Biener <rguenther@suse.de>
Date: Mon Aug 21 09:01:00 2023 +0200
tree-optimization/111070 - fix ICE with recent ifcombine fix
We now got test coverage for non-SSA name bits so the following amends
the SSA_NAME_OCCURS_IN_ABNORMAL_PHI checks.
PR tree-optimization/111070
* tree-ssa-ifcombine.cc (ifcombine_ifandif): Check we have
an SSA name before checking SSA_NAME_OCCURS_IN_ABNORMAL_PHI.
* gcc.dg/pr111070.c: New testcase.
diff --git a/gcc/testsuite/gcc.dg/pr111070.c b/gcc/testsuite/gcc.dg/pr111070.c
new file mode 100644
index 00000000000..1ebc7adf782
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr111070.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-O" } */
+
+/* common */
+char c;
+/* arrays must be 8 byte aligned, regardless of size */
+char c_ary[1];
+
+/* data */
+char d = 1;
+char d_ary[1] = {1};
+
+int main ()
+{
+ if (((unsigned long)&c_ary[0] & 7) != 0)
+ return 1;
+ if (((unsigned long)&d_ary[0] & 7) != 0)
+ return 1;
+ return 0;
+}
--- a/gcc/tree-ssa-ifcombine.c
+++ b/gcc/tree-ssa-ifcombine.c
@@ -430,7 +430,8 @@ ifcombine_ifandif (basic_block inner_cond_bb, bool inner_inv,
{
tree t, t2;
- if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (name1))
+ if (TREE_CODE (name1) == SSA_NAME
+ && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (name1))
return false;
/* Do it. */
@@ -489,8 +490,10 @@ ifcombine_ifandif (basic_block inner_cond_bb, bool inner_inv,
gimple_stmt_iterator gsi;
tree t;
- if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (name1)
- || SSA_NAME_OCCURS_IN_ABNORMAL_PHI (name2))
+ if ((TREE_CODE (name1) == SSA_NAME
+ && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (name1))
+ || (TREE_CODE (name2) == SSA_NAME
+ && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (name2)))
return false;
/* Find the common name which is bit-tested. */

@ -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;
+ }
#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 <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 );
+}

@ -0,0 +1,65 @@
commit 084768c865cd50a6f7ff177db2dbdbb7aadaeee0
Author: Jakub Jelinek <jakub@redhat.com>
Date: Tue Jul 23 10:50:29 2024 +0200
ssa: Fix up maybe_rewrite_mem_ref_base complex type handling [PR116034]
The folding into REALPART_EXPR is correct, used only when the mem_offset
is zero, but for IMAGPART_EXPR it didn't check the exact offset value (just
that it is not 0).
The following patch fixes that by using IMAGPART_EXPR only if the offset
is right and using BITFIELD_REF or whatever else otherwise.
2024-07-23 Jakub Jelinek <jakub@redhat.com>
Andrew Pinski <quic_apinski@quicinc.com>
PR tree-optimization/116034
* tree-ssa.c (maybe_rewrite_mem_ref_base): Only use IMAGPART_EXPR
if MEM_REF offset is equal to element type size.
* gcc.dg/pr116034.c: New test.
(cherry picked from commit b9cefd67a2a464a3c9413e6b3f28e7dc7a9ef162)
diff --git a/gcc/testsuite/gcc.dg/pr116034.c b/gcc/testsuite/gcc.dg/pr116034.c
new file mode 100644
index 00000000000..9a31de03424
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr116034.c
@@ -0,0 +1,22 @@
+/* PR tree-optimization/116034 */
+/* { dg-do run } */
+/* { dg-options "-O1 -fno-strict-aliasing" } */
+
+int g;
+
+static inline int
+foo (_Complex unsigned short c)
+{
+ __builtin_memmove (&g, 1 + (char *) &c, 2);
+ return g;
+}
+
+int
+main ()
+{
+ if (__SIZEOF_SHORT__ == 2
+ && __CHAR_BIT__ == 8
+ && (foo (__BYTE_ORDER__ != __ORDER_BIG_ENDIAN__ ? 0x100 : 1)
+ != (__BYTE_ORDER__ != __ORDER_BIG_ENDIAN__ ? 1 : 0x100)))
+ __builtin_abort ();
+}
--- a/gcc/tree-ssa.c
+++ b/gcc/tree-ssa.c
@@ -1506,7 +1506,10 @@ maybe_rewrite_mem_ref_base (tree *tp, bitmap suitable_for_renaming)
}
else if (TREE_CODE (TREE_TYPE (sym)) == COMPLEX_TYPE
&& useless_type_conversion_p (TREE_TYPE (*tp),
- TREE_TYPE (TREE_TYPE (sym))))
+ TREE_TYPE (TREE_TYPE (sym)))
+ && (integer_zerop (TREE_OPERAND (*tp, 1))
+ || tree_int_cst_equal (TREE_OPERAND (*tp, 1),
+ TYPE_SIZE_UNIT (TREE_TYPE (*tp)))))
{
*tp = build1 (integer_zerop (TREE_OPERAND (*tp, 1))
? REALPART_EXPR : IMAGPART_EXPR,

@ -1,40 +0,0 @@
commit 7f875e435b23dfb439bc7784cade4aebbd5d4a69
Author: Jakub Jelinek <jakub@redhat.com>
Date: Fri Jun 9 09:10:29 2023 +0200
fortran: Fix ICE on pr96024.f90 on big-endian hosts [PR96024]
The pr96024.f90 testcase ICEs on big-endian hosts. The problem is
that length->val.integer is accessed after checking
length->expr_type == EXPR_CONSTANT, but it is a CHARACTER constant
which uses length->val.character union member instead and on big-endian
we end up reading constant 0x100000000 rather than some small number
on little-endian and if target doesn't have enough memory for 4 times
that (i.e. 16GB allocation), it ICEs.
2023-06-09 Jakub Jelinek <jakub@redhat.com>
PR fortran/96024
* primary.c (gfc_convert_to_structure_constructor): Only do
constant string ctor length verification and truncation/padding
if constant length has INTEGER type.
(cherry picked from commit 4cf6e322adc19f927859e0a5edfa93cec4b8c844)
diff --git a/gcc/fortran/primary.c b/gcc/fortran/primary.c
index 1b93f96367f..5cad2d2682b 100644
--- a/gcc/fortran/primary.c
+++ b/gcc/fortran/primary.c
@@ -3188,10 +3188,11 @@ gfc_convert_to_structure_constructor (gfc_expr *e, gfc_symbol *sym, gfc_expr **c
goto cleanup;
/* For a constant string constructor, make sure the length is
- correct; truncate of fill with blanks if needed. */
+ correct; truncate or fill with blanks if needed. */
if (this_comp->ts.type == BT_CHARACTER && !this_comp->attr.allocatable
&& this_comp->ts.u.cl && this_comp->ts.u.cl->length
&& this_comp->ts.u.cl->length->expr_type == EXPR_CONSTANT
+ && this_comp->ts.u.cl->length->ts.type == BT_INTEGER
&& actual->expr->ts.type == BT_CHARACTER
&& actual->expr->expr_type == EXPR_CONSTANT)
{

@ -0,0 +1,348 @@
From 3439b79cb7f97464d65316a94d40d49505fb2150 Mon Sep 17 00:00:00 2001
From: Marek Polacek <polacek@redhat.com>
Date: Wed, 6 Dec 2023 15:34:24 -0500
Subject: [PATCH] aarch64: add -fno-stack-protector to tests
These tests fail when the testsuite is executed with -fstack-protector-strong.
To avoid this, this patch adds -fno-stack-protector to dg-options.
---
gcc/testsuite/gcc.target/aarch64/ldp_stp_unaligned_2.c | 2 +-
gcc/testsuite/gcc.target/aarch64/stack-check-12.c | 2 +-
gcc/testsuite/gcc.target/aarch64/stack-check-prologue-11.c | 2 +-
gcc/testsuite/gcc.target/aarch64/stack-check-prologue-12.c | 2 +-
gcc/testsuite/gcc.target/aarch64/stack-check-prologue-13.c | 4 ++--
gcc/testsuite/gcc.target/aarch64/stack-check-prologue-14.c | 4 ++--
gcc/testsuite/gcc.target/aarch64/stack-check-prologue-15.c | 2 +-
gcc/testsuite/gcc.target/aarch64/stack-check-prologue-17.c | 2 +-
gcc/testsuite/gcc.target/aarch64/stack-check-prologue-18.c | 2 +-
gcc/testsuite/gcc.target/aarch64/stack-check-prologue-2.c | 2 +-
gcc/testsuite/gcc.target/aarch64/stack-check-prologue-5.c | 2 +-
gcc/testsuite/gcc.target/aarch64/stack-check-prologue-6.c | 2 +-
gcc/testsuite/gcc.target/aarch64/stack-check-prologue-8.c | 2 +-
gcc/testsuite/gcc.target/aarch64/stack-check-prologue-9.c | 2 +-
gcc/testsuite/gcc.target/aarch64/sve/struct_vect_24.c | 2 +-
gcc/testsuite/gcc.target/aarch64/test_frame_1.c | 2 +-
gcc/testsuite/gcc.target/aarch64/test_frame_10.c | 2 +-
gcc/testsuite/gcc.target/aarch64/test_frame_11.c | 2 +-
gcc/testsuite/gcc.target/aarch64/test_frame_13.c | 2 +-
gcc/testsuite/gcc.target/aarch64/test_frame_15.c | 2 +-
gcc/testsuite/gcc.target/aarch64/test_frame_2.c | 2 +-
gcc/testsuite/gcc.target/aarch64/test_frame_4.c | 2 +-
gcc/testsuite/gcc.target/aarch64/test_frame_6.c | 2 +-
gcc/testsuite/gcc.target/aarch64/test_frame_7.c | 2 +-
gcc/testsuite/gcc.target/aarch64/test_frame_8.c | 2 +-
30 files changed, 32 insertions(+), 32 deletions(-)
diff --git a/gcc/testsuite/gcc.target/aarch64/ldp_stp_unaligned_2.c b/gcc/testsuite/gcc.target/aarch64/ldp_stp_unaligned_2.c
index 1e46755a39a..50d7d7a2d5d 100644
--- a/gcc/testsuite/gcc.target/aarch64/ldp_stp_unaligned_2.c
+++ b/gcc/testsuite/gcc.target/aarch64/ldp_stp_unaligned_2.c
@@ -1,4 +1,4 @@
-/* { dg-options "-O2 -fomit-frame-pointer" } */
+/* { dg-options "-O2 -fomit-frame-pointer -fno-stack-protector" } */
/* Check that we split unaligned LDP/STP into base and aligned offset. */
diff --git a/gcc/testsuite/gcc.target/aarch64/stack-check-12.c b/gcc/testsuite/gcc.target/aarch64/stack-check-12.c
index be5a57a9ec6..e1a4c67b041 100644
--- a/gcc/testsuite/gcc.target/aarch64/stack-check-12.c
+++ b/gcc/testsuite/gcc.target/aarch64/stack-check-12.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fstack-clash-protection --param stack-clash-protection-guard-size=16 -fno-asynchronous-unwind-tables -fno-unwind-tables" } */
+/* { dg-options "-O2 -fstack-clash-protection --param stack-clash-protection-guard-size=16 -fno-asynchronous-unwind-tables -fno-unwind-tables -fno-stack-protector" } */
/* { dg-require-effective-target supports_stack_clash_protection } */
typedef unsigned __attribute__((mode(DI))) uint64_t;
diff --git a/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-11.c b/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-11.c
index 741f2f5fadc..d57aece05bb 100644
--- a/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-11.c
+++ b/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-11.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fstack-clash-protection --param stack-clash-protection-guard-size=16" } */
+/* { dg-options "-O2 -fstack-clash-protection --param stack-clash-protection-guard-size=16 -fno-stack-protector" } */
/* { dg-require-effective-target supports_stack_clash_protection } */
#define SIZE (6 * 64 * 1024) + (1 * 32 * 1024)
diff --git a/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-12.c b/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-12.c
index ece68003ade..895d130e4fa 100644
--- a/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-12.c
+++ b/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-12.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fstack-clash-protection --param stack-clash-protection-guard-size=16 -fomit-frame-pointer -momit-leaf-frame-pointer" } */
+/* { dg-options "-O2 -fstack-clash-protection --param stack-clash-protection-guard-size=16 -fomit-frame-pointer -momit-leaf-frame-pointer -fno-stack-protector" } */
/* { dg-require-effective-target supports_stack_clash_protection } */
void
diff --git a/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-13.c b/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-13.c
index 0fc900c6943..1f1a6c497be 100644
--- a/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-13.c
+++ b/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-13.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fstack-clash-protection --param stack-clash-protection-guard-size=16 -fomit-frame-pointer -momit-leaf-frame-pointer" } */
+/* { dg-options "-O2 -fstack-clash-protection --param stack-clash-protection-guard-size=16 -fomit-frame-pointer -momit-leaf-frame-pointer -fno-stack-protector" } */
/* { dg-require-effective-target supports_stack_clash_protection } */
void h (void) __attribute__ ((noreturn));
@@ -17,4 +17,4 @@ f (void)
/* SIZE is more than 1 guard-size, but only one 64KB page is used, expect only 1
probe. Leaf function and omitting leaf pointers, tail call to noreturn which
- may only omit an epilogue and not a prologue. Checking for LR saving. */
\ No newline at end of file
+ may only omit an epilogue and not a prologue. Checking for LR saving. */
diff --git a/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-14.c b/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-14.c
index ea733f861e7..facb3cb72a7 100644
--- a/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-14.c
+++ b/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-14.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fstack-clash-protection --param stack-clash-protection-guard-size=16 -fomit-frame-pointer -momit-leaf-frame-pointer" } */
+/* { dg-options "-O2 -fstack-clash-protection --param stack-clash-protection-guard-size=16 -fomit-frame-pointer -momit-leaf-frame-pointer -fno-stack-protector" } */
/* { dg-require-effective-target supports_stack_clash_protection } */
void h (void) __attribute__ ((noreturn));
@@ -21,4 +21,4 @@ f (void)
probe at 1024 and one implicit probe due to LR being saved. Leaf function
and omitting leaf pointers, tail call to noreturn which may only omit an
epilogue and not a prologue and control flow in between. Checking for
- LR saving. */
\ No newline at end of file
+ LR saving. */
diff --git a/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-15.c b/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-15.c
index 63df4a5609a..f2ac60a6214 100644
--- a/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-15.c
+++ b/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-15.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fstack-clash-protection --param stack-clash-protection-guard-size=16 -fomit-frame-pointer -momit-leaf-frame-pointer" } */
+/* { dg-options "-O2 -fstack-clash-protection --param stack-clash-protection-guard-size=16 -fomit-frame-pointer -momit-leaf-frame-pointer -fno-stack-protector" } */
/* { dg-require-effective-target supports_stack_clash_protection } */
void g (volatile int *x) ;
diff --git a/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-17.c b/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-17.c
index f0ec1389771..1cf6fbbb085 100644
--- a/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-17.c
+++ b/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-17.c
@@ -1,4 +1,4 @@
-/* { dg-options "-O2 -fstack-clash-protection -fomit-frame-pointer --param stack-clash-protection-guard-size=12" } */
+/* { dg-options "-O2 -fstack-clash-protection -fomit-frame-pointer --param stack-clash-protection-guard-size=12 -fno-stack-protector" } */
/* { dg-final { check-function-bodies "**" "" } } */
void f(int, ...);
diff --git a/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-18.c b/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-18.c
index 6383bec5ebc..2e06346c158 100644
--- a/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-18.c
+++ b/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-18.c
@@ -1,4 +1,4 @@
-/* { dg-options "-O2 -fstack-clash-protection -fomit-frame-pointer --param stack-clash-protection-guard-size=12" } */
+/* { dg-options "-O2 -fstack-clash-protection -fomit-frame-pointer --param stack-clash-protection-guard-size=12 -fno-stack-protector" } */
/* { dg-final { check-function-bodies "**" "" } } */
void f(int, ...);
diff --git a/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-2.c b/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-2.c
index 61c52a251a7..b37f62cad27 100644
--- a/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-2.c
+++ b/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-2.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fstack-clash-protection --param stack-clash-protection-guard-size=16" } */
+/* { dg-options "-O2 -fstack-clash-protection --param stack-clash-protection-guard-size=16 -fno-stack-protector" } */
/* { dg-require-effective-target supports_stack_clash_protection } */
#define SIZE 2 * 1024
diff --git a/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-5.c b/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-5.c
index 2ee16350127..34a438671d0 100644
--- a/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-5.c
+++ b/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-5.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fstack-clash-protection --param stack-clash-protection-guard-size=16" } */
+/* { dg-options "-O2 -fstack-clash-protection --param stack-clash-protection-guard-size=16 -fno-stack-protector" } */
/* { dg-require-effective-target supports_stack_clash_protection } */
#define SIZE 64 * 1024
diff --git a/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-6.c b/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-6.c
index 3c9b606cbe0..a4e34e2fe6a 100644
--- a/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-6.c
+++ b/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-6.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fstack-clash-protection --param stack-clash-protection-guard-size=16" } */
+/* { dg-options "-O2 -fstack-clash-protection --param stack-clash-protection-guard-size=16 -fno-stack-protector" } */
/* { dg-require-effective-target supports_stack_clash_protection } */
#define SIZE 65 * 1024
diff --git a/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-8.c b/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-8.c
index 333f5fcc360..277dce4c71e 100644
--- a/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-8.c
+++ b/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-8.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fstack-clash-protection --param stack-clash-protection-guard-size=16" } */
+/* { dg-options "-O2 -fstack-clash-protection --param stack-clash-protection-guard-size=16 -fno-stack-protector" } */
/* { dg-require-effective-target supports_stack_clash_protection } */
#define SIZE 128 * 1024
diff --git a/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-9.c b/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-9.c
index a3ff89b5581..a21305541c1 100644
--- a/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-9.c
+++ b/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-9.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fstack-clash-protection --param stack-clash-protection-guard-size=16" } */
+/* { dg-options "-O2 -fstack-clash-protection --param stack-clash-protection-guard-size=16 -fno-stack-protector" } */
/* { dg-require-effective-target supports_stack_clash_protection } */
#define SIZE 6 * 64 * 1024
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/struct_vect_24.c b/gcc/testsuite/gcc.target/aarch64/sve/struct_vect_24.c
index 68a9d5e3d2e..19be6de0c2e 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/struct_vect_24.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/struct_vect_24.c
@@ -1,6 +1,6 @@
/* { dg-do compile } */
/* { dg-require-effective-target supports_stack_clash_protection } */
-/* { dg-options "-O3 -fopenmp-simd -fstack-clash-protection --param stack-clash-protection-guard-size=16" } */
+/* { dg-options "-O3 -fopenmp-simd -fstack-clash-protection --param stack-clash-protection-guard-size=16 -fno-stack-protector" } */
#include <stdint.h>
diff --git a/gcc/testsuite/gcc.target/aarch64/test_frame_1.c b/gcc/testsuite/gcc.target/aarch64/test_frame_1.c
index f906b073545..c9b8822b4b1 100644
--- a/gcc/testsuite/gcc.target/aarch64/test_frame_1.c
+++ b/gcc/testsuite/gcc.target/aarch64/test_frame_1.c
@@ -6,7 +6,7 @@
* optimized code should use "str !" for stack adjustment. */
/* { dg-do run } */
-/* { dg-options "-O2 -fomit-frame-pointer --save-temps" } */
+/* { dg-options "-O2 -fomit-frame-pointer --save-temps -fno-stack-protector" } */
#include "test_frame_common.h"
diff --git a/gcc/testsuite/gcc.target/aarch64/test_frame_10.c b/gcc/testsuite/gcc.target/aarch64/test_frame_10.c
index c54ab2d0ccb..fe5cbd9ed05 100644
--- a/gcc/testsuite/gcc.target/aarch64/test_frame_10.c
+++ b/gcc/testsuite/gcc.target/aarch64/test_frame_10.c
@@ -7,7 +7,7 @@
* Use a single stack adjustment, no writeback. */
/* { dg-do run } */
-/* { dg-options "-O2 -fomit-frame-pointer --save-temps" } */
+/* { dg-options "-O2 -fomit-frame-pointer --save-temps -fno-stack-protector" } */
#include "test_frame_common.h"
diff --git a/gcc/testsuite/gcc.target/aarch64/test_frame_11.c b/gcc/testsuite/gcc.target/aarch64/test_frame_11.c
index f162cc091e0..11cf471168d 100644
--- a/gcc/testsuite/gcc.target/aarch64/test_frame_11.c
+++ b/gcc/testsuite/gcc.target/aarch64/test_frame_11.c
@@ -5,7 +5,7 @@
* optimized code should use "stp !" for stack adjustment. */
/* { dg-do run } */
-/* { dg-options "-O2 --save-temps" } */
+/* { dg-options "-O2 --save-temps -fno-stack-protector" } */
#include "test_frame_common.h"
diff --git a/gcc/testsuite/gcc.target/aarch64/test_frame_13.c b/gcc/testsuite/gcc.target/aarch64/test_frame_13.c
index 74b3370fa46..ec56963c038 100644
--- a/gcc/testsuite/gcc.target/aarch64/test_frame_13.c
+++ b/gcc/testsuite/gcc.target/aarch64/test_frame_13.c
@@ -5,7 +5,7 @@
* Use a single stack adjustment, no writeback. */
/* { dg-do run } */
-/* { dg-options "-O2 --save-temps" } */
+/* { dg-options "-O2 --save-temps -fno-stack-protector" } */
#include "test_frame_common.h"
diff --git a/gcc/testsuite/gcc.target/aarch64/test_frame_15.c b/gcc/testsuite/gcc.target/aarch64/test_frame_15.c
index bed6714b4fe..4247008de8e 100644
--- a/gcc/testsuite/gcc.target/aarch64/test_frame_15.c
+++ b/gcc/testsuite/gcc.target/aarch64/test_frame_15.c
@@ -6,7 +6,7 @@
* Use a single stack adjustment, no writeback. */
/* { dg-do run } */
-/* { dg-options "-O2 --save-temps" } */
+/* { dg-options "-O2 --save-temps -fno-stack-protector" } */
#include "test_frame_common.h"
diff --git a/gcc/testsuite/gcc.target/aarch64/test_frame_2.c b/gcc/testsuite/gcc.target/aarch64/test_frame_2.c
index 0d715314cb8..9c4243b6480 100644
--- a/gcc/testsuite/gcc.target/aarch64/test_frame_2.c
+++ b/gcc/testsuite/gcc.target/aarch64/test_frame_2.c
@@ -6,7 +6,7 @@
* optimized code should use "stp !" for stack adjustment. */
/* { dg-do run } */
-/* { dg-options "-O2 -fomit-frame-pointer --save-temps" } */
+/* { dg-options "-O2 -fomit-frame-pointer --save-temps -fno-stack-protector" } */
#include "test_frame_common.h"
diff --git a/gcc/testsuite/gcc.target/aarch64/test_frame_4.c b/gcc/testsuite/gcc.target/aarch64/test_frame_4.c
index b41229c42f4..8d0bed93e44 100644
--- a/gcc/testsuite/gcc.target/aarch64/test_frame_4.c
+++ b/gcc/testsuite/gcc.target/aarch64/test_frame_4.c
@@ -6,7 +6,7 @@
* we can use "stp !" to optimize stack adjustment. */
/* { dg-do run } */
-/* { dg-options "-O2 -fomit-frame-pointer --save-temps" } */
+/* { dg-options "-O2 -fomit-frame-pointer --save-temps -fno-stack-protector" } */
#include "test_frame_common.h"
diff --git a/gcc/testsuite/gcc.target/aarch64/test_frame_6.c b/gcc/testsuite/gcc.target/aarch64/test_frame_6.c
index 56259c945d2..2944a8bbe16 100644
--- a/gcc/testsuite/gcc.target/aarch64/test_frame_6.c
+++ b/gcc/testsuite/gcc.target/aarch64/test_frame_6.c
@@ -6,7 +6,7 @@
* use a single stack adjustment, no writeback. */
/* { dg-do run } */
-/* { dg-options "-O2 -fomit-frame-pointer --save-temps" } */
+/* { dg-options "-O2 -fomit-frame-pointer --save-temps -fno-stack-protector" } */
#include "test_frame_common.h"
diff --git a/gcc/testsuite/gcc.target/aarch64/test_frame_7.c b/gcc/testsuite/gcc.target/aarch64/test_frame_7.c
index 5702656a5da..ca371632d81 100644
--- a/gcc/testsuite/gcc.target/aarch64/test_frame_7.c
+++ b/gcc/testsuite/gcc.target/aarch64/test_frame_7.c
@@ -6,7 +6,7 @@
* use a single stack adjustment, no writeback. */
/* { dg-do run } */
-/* { dg-options "-O2 -fomit-frame-pointer --save-temps" } */
+/* { dg-options "-O2 -fomit-frame-pointer --save-temps -fno-stack-protector" } */
#include "test_frame_common.h"
diff --git a/gcc/testsuite/gcc.target/aarch64/test_frame_8.c b/gcc/testsuite/gcc.target/aarch64/test_frame_8.c
index 75a68b41e08..084e8fac373 100644
--- a/gcc/testsuite/gcc.target/aarch64/test_frame_8.c
+++ b/gcc/testsuite/gcc.target/aarch64/test_frame_8.c
@@ -5,7 +5,7 @@
* number of callee-saved reg == 1. */
/* { dg-do run } */
-/* { dg-options "-O2 -fomit-frame-pointer --save-temps" } */
+/* { dg-options "-O2 -fomit-frame-pointer --save-temps -fno-stack-protector" } */
#include "test_frame_common.h"
base-commit: 1bd15d87031e8bf8fe9585fbc166b315303f676c
--
2.43.0

@ -0,0 +1,150 @@
commit f1b1d515aa5836844cdb45e8bb2b941784f78fd2
Author: Jakub Jelinek <jakub@redhat.com>
Date: Mon Apr 22 18:00:06 2024 +0200
libstdc++: Workaround kernel-headers on s390x-linux
We see
FAIL: 17_intro/headers/c++1998/all_attributes.cc (test for excess errors)
FAIL: 17_intro/headers/c++2011/all_attributes.cc (test for excess errors)
FAIL: 17_intro/headers/c++2014/all_attributes.cc (test for excess errors)
FAIL: 17_intro/headers/c++2017/all_attributes.cc (test for excess errors)
FAIL: 17_intro/headers/c++2020/all_attributes.cc (test for excess errors)
FAIL: 17_intro/names.cc -std=gnu++17 (test for excess errors)
on s390x-linux.
The first 5 are due to kernel-headers not using uglified attribute names,
where <asm/types.h> contains
__attribute__((packed, aligned(4)))
I've filed a downstream bugreport for this in
https://bugzilla.redhat.com/show_bug.cgi?id=2276084
(not really sure where to report kernel-headers issues upstream), while the
last one is due to <sys/ucontext.h> from glibc containing:
#ifdef __USE_MISC
# define __ctx(fld) fld
#else
# define __ctx(fld) __ ## fld
#endif
...
typedef union
{
double __ctx(d);
float __ctx(f);
} fpreg_t;
and g++ predefining -D_GNU_SOURCE which implies define __USE_MISC.
The following patch adds a workaround for this on the libstdc++ testsuite
side.
2024-04-22 Jakub Jelinek <jakub@redhat.com>
* testsuite/17_intro/names.cc (d, f): Undefine on s390*-linux*.
* testsuite/17_intro/headers/c++1998/all_attributes.cc (packed): Don't
define on s390.
* testsuite/17_intro/headers/c++2011/all_attributes.cc (packed):
Likewise.
* testsuite/17_intro/headers/c++2014/all_attributes.cc (packed):
Likewise.
* testsuite/17_intro/headers/c++2017/all_attributes.cc (packed):
Likewise.
* testsuite/17_intro/headers/c++2020/all_attributes.cc (packed):
Likewise.
(cherry picked from commit cf5f7791056b3ed993bc8024be767a86157514a9)
diff --git a/libstdc++-v3/testsuite/17_intro/headers/c++1998/all_attributes.cc b/libstdc++-v3/testsuite/17_intro/headers/c++1998/all_attributes.cc
index 74268b6a482..658063bd0a4 100644
--- a/libstdc++-v3/testsuite/17_intro/headers/c++1998/all_attributes.cc
+++ b/libstdc++-v3/testsuite/17_intro/headers/c++1998/all_attributes.cc
@@ -29,7 +29,11 @@
# define noreturn 1
# define visibility 1
#endif
+#ifndef __s390__
+// kernel-headers <asm/types.h> uses __attribute__((packed,aligned(4))) on
+// S390.
#define packed 1
+#endif
#define pure 1
// glibc's sysdeps/unix/sysv/linux/arm/sys/ucontext.h uses this on ARM.
#ifndef __arm__
diff --git a/libstdc++-v3/testsuite/17_intro/headers/c++2011/all_attributes.cc b/libstdc++-v3/testsuite/17_intro/headers/c++2011/all_attributes.cc
index 5d0c5fe8177..f1bcc1fbbc8 100644
--- a/libstdc++-v3/testsuite/17_intro/headers/c++2011/all_attributes.cc
+++ b/libstdc++-v3/testsuite/17_intro/headers/c++2011/all_attributes.cc
@@ -29,7 +29,11 @@
# define visibility 1
#endif
#define no_unique_address 1
+#ifndef __s390__
+// kernel-headers <asm/types.h> uses __attribute__((packed,aligned(4))) on
+// S390.
#define packed 1
+#endif
#define pure 1
// glibc's sysdeps/unix/sysv/linux/arm/sys/ucontext.h uses this on ARM.
#ifndef __arm__
diff --git a/libstdc++-v3/testsuite/17_intro/headers/c++2014/all_attributes.cc b/libstdc++-v3/testsuite/17_intro/headers/c++2014/all_attributes.cc
index 3cac2190ec7..48e7ef64afb 100644
--- a/libstdc++-v3/testsuite/17_intro/headers/c++2014/all_attributes.cc
+++ b/libstdc++-v3/testsuite/17_intro/headers/c++2014/all_attributes.cc
@@ -29,7 +29,11 @@
# define visibility 1
#endif
#define no_unique_address 1
+#ifndef __s390__
+// kernel-headers <asm/types.h> uses __attribute__((packed,aligned(4))) on
+// S390.
#define packed 1
+#endif
#define pure 1
// glibc's sysdeps/unix/sysv/linux/arm/sys/ucontext.h uses this on ARM.
#ifndef __arm__
diff --git a/libstdc++-v3/testsuite/17_intro/headers/c++2017/all_attributes.cc b/libstdc++-v3/testsuite/17_intro/headers/c++2017/all_attributes.cc
index f607532aa90..03e4e23c686 100644
--- a/libstdc++-v3/testsuite/17_intro/headers/c++2017/all_attributes.cc
+++ b/libstdc++-v3/testsuite/17_intro/headers/c++2017/all_attributes.cc
@@ -28,7 +28,11 @@
# define visibility 1
#endif
#define no_unique_address 1
+#ifndef __s390__
+// kernel-headers <asm/types.h> uses __attribute__((packed,aligned(4))) on
+// S390.
#define packed 1
+#endif
#define pure 1
// glibc's sysdeps/unix/sysv/linux/arm/sys/ucontext.h uses this on ARM.
#ifndef __arm__
diff --git a/libstdc++-v3/testsuite/17_intro/headers/c++2020/all_attributes.cc b/libstdc++-v3/testsuite/17_intro/headers/c++2020/all_attributes.cc
index 5732633c7e4..7375dc88bb1 100644
--- a/libstdc++-v3/testsuite/17_intro/headers/c++2020/all_attributes.cc
+++ b/libstdc++-v3/testsuite/17_intro/headers/c++2020/all_attributes.cc
@@ -27,7 +27,11 @@
# define cold 1
# define visibility 1
#endif
+#ifndef __s390__
+// kernel-headers <asm/types.h> uses __attribute__((packed,aligned(4))) on
+// S390.
#define packed 1
+#endif
#define pure 1
// glibc's sysdeps/unix/sysv/linux/arm/sys/ucontext.h uses this on ARM.
#ifndef __arm__
diff --git a/libstdc++-v3/testsuite/17_intro/names.cc b/libstdc++-v3/testsuite/17_intro/names.cc
index eb4d064177c..864bc20f146 100644
--- a/libstdc++-v3/testsuite/17_intro/names.cc
+++ b/libstdc++-v3/testsuite/17_intro/names.cc
@@ -267,6 +267,12 @@
#undef u
#endif
+#if defined (__linux__) && defined (__s390__)
+// <sys/ucontext.h> defines fpreg_t::d and fpreg_t::f
+#undef d
+#undef f
+#endif
+
#if defined (__linux__) && defined (__sparc__)
#undef y
#endif

@ -1,4 +1,4 @@
SHA512 (gcc-11.4.1-20230605.tar.xz) = 524e57dc5e4d0622597de820a2126621607222492acdfb8c11865b8eff8fe3efc41270856e7ee4b054007f35e8fd4dc7f336274c7a34009ec67d2e9a491d2724
SHA512 (gcc-11.5.0-20240719.tar.xz) = 8996ff2aaad765521303f0bde46e4c53992de266062ceabaef0b311ef68be6068e9b0002a57c036d898a6d58735f4d1884e6a7a152c567f941adb200d076fcd4
SHA512 (isl-0.18.tar.bz2) = 85d0b40f4dbf14cb99d17aa07048cdcab2dc3eb527d2fbb1e84c41b2de5f351025370e57448b63b2b8a8cf8a0843a089c3263f9baee1542d5c2e1cb37ed39d94
SHA512 (newlib-cygwin-50e2a63b04bdd018484605fbb954fd1bd5147fa0.tar.xz) = 002a48a7b689a81abbf16161bcaec001a842e67dfbe372e9e109092703bfc666675f16198f60ca429370e8850d564547dc505df81bc3aaca4ce6defbc014ad6c
SHA512 (nvptx-tools-5f6f343a302d620b0868edab376c00b15741e39e.tar.xz) = f6d10db94fa1570ae0f94df073fa3c73c8e5ee16d59070b53d94f7db0de8a031bc44d7f3f1852533da04b625ce758e022263855ed43cfc6867e0708d001e53c7

Loading…
Cancel
Save