diff --git a/gcc.spec b/gcc.spec index 2ec7ade..6514855 100644 --- a/gcc.spec +++ b/gcc.spec @@ -292,6 +292,8 @@ Patch28: gcc11-s390x-regarg-2.patch Patch29: gcc11-s390x-regarg-3.patch Patch30: gcc11-testsuite-fixes.patch Patch32: gcc11-testsuite-fixes-2.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 @@ -893,7 +895,9 @@ mark them as cross compiled. %patch29 -p1 -b .s390x-regarg-3~ %patch30 -p1 -b .testsuite~ %patch32 -p1 -b .testsuite2~ -%patch35 -p1 -b .testsuite3~ +%patch33 -p1 -b .testsuite3~ +%patch34 -p0 -b .pr116034~ +%patch35 -p1 -b .testsuite4~ %patch36 -p1 -b .libgfortran-flush~ %patch37 -p1 -b .pr113960~ %patch38 -p1 -b .pr105157~ @@ -3592,6 +3596,8 @@ end %changelog * Mon Jul 22 2024 Marek Polacek 11.5.0-2 - fix TARGET_CPU_DEFAULT (PR target/105157, RHEL-50037) +- libstdc++: Workaround kernel-headers on s390x-linux (RHEL-50054) +- fix wrong code with memcpy from _Complex (PR tree-optimization/116034) * Fri Jul 19 2024 Marek Polacek 11.5.0-1 - update from releases/gcc-11 branch (RHEL-35635) diff --git a/gcc11-pr116034.patch b/gcc11-pr116034.patch new file mode 100644 index 0000000..d282f3a --- /dev/null +++ b/gcc11-pr116034.patch @@ -0,0 +1,47 @@ +2024-07-22 Jakub Jelinek + Andrew Pinski + + PR tree-optimization/116034 + * tree-sra.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. + +--- gcc/tree-ssa.c.jj 2024-03-11 11:00:46.768915988 +0100 ++++ gcc/tree-ssa.c 2024-07-22 21:27:02.115530861 +0200 +@@ -1506,7 +1506,10 @@ maybe_rewrite_mem_ref_base (tree *tp, bi + } + 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, +--- gcc/testsuite/gcc.dg/pr116034.c.jj 2024-07-22 21:39:50.050994243 +0200 ++++ gcc/testsuite/gcc.dg/pr116034.c 2024-07-22 21:39:32.432213042 +0200 +@@ -0,0 +1,21 @@ ++/* 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_LITTLE_ENDIAN__ ? 0x0100 : 1) != 1) ++ __builtin_abort (); ++} diff --git a/gcc11-testsuite-fixes-3.patch b/gcc11-testsuite-fixes-3.patch new file mode 100644 index 0000000..25ea3a9 --- /dev/null +++ b/gcc11-testsuite-fixes-3.patch @@ -0,0 +1,150 @@ +commit f1b1d515aa5836844cdb45e8bb2b941784f78fd2 +Author: Jakub Jelinek +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 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 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 + + * 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 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 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 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 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 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__) ++// defines fpreg_t::d and fpreg_t::f ++#undef d ++#undef f ++#endif ++ + #if defined (__linux__) && defined (__sparc__) + #undef y + #endif