diff --git a/0042-Struct-Reorg-Fix-speccpu2006-462-double-free-I60YUV.patch b/0042-Struct-Reorg-Fix-speccpu2006-462-double-free-I60YUV.patch new file mode 100644 index 0000000000000000000000000000000000000000..b9214c6885a5e8c7bee6afd02e8f64eb9e3db758 --- /dev/null +++ b/0042-Struct-Reorg-Fix-speccpu2006-462-double-free-I60YUV.patch @@ -0,0 +1,38 @@ +From b669b4512e8425f4d752ef76bf61097cf40d9b35 Mon Sep 17 00:00:00 2001 +From: zgat <1071107108@qq.com> +Date: Thu, 17 Nov 2022 02:55:48 +0000 +Subject: [Struct Reorg] Fix speccpu2006 462 double free #I60YUV + modify gcc/tree.c. Normal operation speccpu 462 after modifed + +Signed-off-by: zgat <1071107108@qq.com> +--- + gcc/tree.c | 6 ++---- + 1 file changed, 2 insertions(+), 4 deletions(-) + +diff --git a/gcc/tree.c b/gcc/tree.c +index 2a532d15a..a61788651 100644 +--- a/gcc/tree.c ++++ b/gcc/tree.c +@@ -5224,8 +5224,7 @@ fld_simplified_type_name (tree type) + optimizations. */ + if (flag_ipa_struct_reorg + && lang_c_p () +- && flag_lto_partition == LTO_PARTITION_ONE +- && (in_lto_p || flag_whole_program)) ++ && flag_lto_partition == LTO_PARTITION_ONE) + return TYPE_NAME (type); + + if (!TYPE_NAME (type) || TREE_CODE (TYPE_NAME (type)) != TYPE_DECL) +@@ -5471,8 +5470,7 @@ fld_simplified_type (tree t, class free_lang_data_d *fld) + optimizations. */ + if (flag_ipa_struct_reorg + && lang_c_p () +- && flag_lto_partition == LTO_PARTITION_ONE +- && (in_lto_p || flag_whole_program)) ++ && flag_lto_partition == LTO_PARTITION_ONE) + return t; + if (POINTER_TYPE_P (t)) + return fld_incomplete_type_of (t, fld); +-- +2.27.0.windows.1 + diff --git a/0043-bogus-Wstringop-overflow-with-VLA-of-elements-larger.patch b/0043-bogus-Wstringop-overflow-with-VLA-of-elements-larger.patch new file mode 100644 index 0000000000000000000000000000000000000000..3638a881703256bc03ba989c7ec6dbd21d616b87 --- /dev/null +++ b/0043-bogus-Wstringop-overflow-with-VLA-of-elements-larger.patch @@ -0,0 +1,129 @@ +From bf537e82d452ee9b79f438df721c2e0dfaae12a0 Mon Sep 17 00:00:00 2001 +From: Xiong Zhou +Date: Fri, 5 May 2023 11:57:40 +0800 +Subject: bogus -Wstringop-overflow with VLA of elements larger + than byte + +--- + gcc/calls.c | 5 ++ + gcc/testsuite/gcc.dg/Wstringop-overflow-67.c | 92 ++++++++++++++++++++ + 2 files changed, 97 insertions(+) + create mode 100644 gcc/testsuite/gcc.dg/Wstringop-overflow-67.c + +diff --git a/gcc/calls.c b/gcc/calls.c +index 26894342c..45c137cee 100644 +--- a/gcc/calls.c ++++ b/gcc/calls.c +@@ -2112,6 +2112,11 @@ maybe_warn_rdwr_sizes (rdwr_map *rwm, tree fndecl, tree fntype, tree exp) + } + else + { ++ /* If the size cannot be determined clear it to keep it from ++ being taken as real (and excessive). */ ++ if (objsize && integer_all_onesp (objsize)) ++ objsize = NULL_TREE; ++ + /* For read-only and read-write attributes also set the source + size. */ + srcsize = objsize; +diff --git a/gcc/testsuite/gcc.dg/Wstringop-overflow-67.c b/gcc/testsuite/gcc.dg/Wstringop-overflow-67.c +new file mode 100644 +index 000000000..7b8f3f014 +--- /dev/null ++++ b/gcc/testsuite/gcc.dg/Wstringop-overflow-67.c +@@ -0,0 +1,92 @@ ++/* PR middle-end/100571 - bogus -Wstringop-overflow with VLA of elements ++ larger than byte ++ { dg-do compile } ++ { dg-options "-O2 -Wall" } */ ++ ++__attribute__ ((access (read_only, 1, 2))) void fro (int *, int); ++__attribute__ ((access (write_only, 1, 2))) void fwo (int *, int); ++__attribute__ ((access (read_write, 1, 2))) void frw (int *, int); ++ ++extern __SIZE_TYPE__ n; ++ ++void alloca_ro (void) ++{ ++ int *a = __builtin_alloca (n * sizeof *a); ++ a[0] = 0; ++ fro (a, n); ++} ++ ++void alloca_wo (void) ++{ ++ int *a = __builtin_alloca (n * sizeof *a); ++ fwo (a, n); ++} ++ ++void alloca_rw (void) ++{ ++ int *a = __builtin_alloca (n * sizeof *a); ++ a[0] = 0; ++ frw (a, n); ++} ++ ++ ++void calloc_ro (void) ++{ ++ int *a = __builtin_calloc (n, sizeof *a); ++ fro (a, n); ++} ++ ++void calloc_wo (void) ++{ ++ int *a = __builtin_calloc (n, sizeof *a); ++ fwo (a, n); ++} ++ ++void calloc_rw (void) ++{ ++ int *a = __builtin_calloc (n, sizeof *a); ++ a[0] = 0; ++ frw (a, n); ++} ++ ++ ++void malloc_ro (void) ++{ ++ int *a = __builtin_malloc (n * sizeof *a); ++ a[0] = 0; ++ fro (a, n); ++} ++ ++void malloc_wo (void) ++{ ++ int *a = __builtin_malloc (n * sizeof *a); ++ fwo (a, n); ++} ++ ++void malloc_rw (void) ++{ ++ int *a = __builtin_malloc (n * sizeof *a); ++ a[0] = 0; ++ frw (a, n); ++} ++ ++ ++void vla_ro (void) ++{ ++ int a[n]; ++ a[0] = 0; ++ fro (a, n); ++} ++ ++void vla_wo (void) ++{ ++ int a[n]; ++ fwo (a, n); ++} ++ ++void vla_rw (void) ++{ ++ int a[n]; ++ a[0] = 0; ++ frw (a, n); ++} +-- +2.33.0 + diff --git a/0044-Backport-Fix-zero-masking-for-vcvtps2ph-when-dest-op.patch b/0044-Backport-Fix-zero-masking-for-vcvtps2ph-when-dest-op.patch new file mode 100644 index 0000000000000000000000000000000000000000..987d9fcdf2a781bd9fadeb164114ca2bb287336e --- /dev/null +++ b/0044-Backport-Fix-zero-masking-for-vcvtps2ph-when-dest-op.patch @@ -0,0 +1,172 @@ +From 5b473317f6b1890238f1778d0fdebf8ed09292d9 Mon Sep 17 00:00:00 2001 +From: liuhongt +Date: Fri, 29 May 2020 13:38:49 +0800 +Subject: [Backport] Fix zero-masking for vcvtps2ph when dest + operand is memory. + +Reference: https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=43088bb4dadd3d14b6b594c5f9363fe879f3d7f7 + +When dest is memory, zero-masking is not valid, only merging-masking is available, + +2020-06-24 Hongtao Liu + +gcc/ChangeLog: + PR target/95254 + * config/i386/sse.md (*vcvtps2ph_store): + Refine from *vcvtps2ph_store. + (vcvtps2ph256): Refine constraint from vm to v. + (avx512f_vcvtps2ph512): Ditto. + (*vcvtps2ph256): New define_insn. + (*avx512f_vcvtps2ph512): Ditto. + * config/i386/subst.md (merge_mask): New define_subst. + (merge_mask_name): New define_subst_attr. + (merge_mask_operand3): Ditto. + +gcc/testsuite/ChangeLog: + * gcc.target/i386/avx512f-vcvtps2ph-pr95254.c: New test. + * gcc.target/i386/avx512vl-vcvtps2ph-pr95254.c: Ditto. +--- + gcc/config/i386/sse.md | 32 ++++++++++++++++--- + gcc/config/i386/subst.md | 12 +++++++ + .../i386/avx512f-vcvtps2ph-pr95254.c | 12 +++++++ + .../i386/avx512vl-vcvtps2ph-pr95254.c | 18 +++++++++++ + 4 files changed, 70 insertions(+), 4 deletions(-) + create mode 100644 gcc/testsuite/gcc.target/i386/avx512f-vcvtps2ph-pr95254.c + create mode 100644 gcc/testsuite/gcc.target/i386/avx512vl-vcvtps2ph-pr95254.c + +diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md +index bf01e1d74..915b8e3d2 100644 +--- a/gcc/config/i386/sse.md ++++ b/gcc/config/i386/sse.md +@@ -21354,19 +21354,19 @@ + (set_attr "prefix" "maybe_evex") + (set_attr "mode" "V4SF")]) + +-(define_insn "*vcvtps2ph_store" ++(define_insn "*vcvtps2ph_store" + [(set (match_operand:V4HI 0 "memory_operand" "=m") + (unspec:V4HI [(match_operand:V4SF 1 "register_operand" "v") + (match_operand:SI 2 "const_0_to_255_operand" "N")] + UNSPEC_VCVTPS2PH))] + "TARGET_F16C || TARGET_AVX512VL" +- "vcvtps2ph\t{%2, %1, %0|%0, %1, %2}" ++ "vcvtps2ph\t{%2, %1, %0|%0, %1, %2}" + [(set_attr "type" "ssecvt") + (set_attr "prefix" "maybe_evex") + (set_attr "mode" "V4SF")]) + + (define_insn "vcvtps2ph256" +- [(set (match_operand:V8HI 0 "nonimmediate_operand" "=vm") ++ [(set (match_operand:V8HI 0 "register_operand" "=v") + (unspec:V8HI [(match_operand:V8SF 1 "register_operand" "v") + (match_operand:SI 2 "const_0_to_255_operand" "N")] + UNSPEC_VCVTPS2PH))] +@@ -21377,8 +21377,20 @@ + (set_attr "btver2_decode" "vector") + (set_attr "mode" "V8SF")]) + ++(define_insn "*vcvtps2ph256" ++ [(set (match_operand:V8HI 0 "memory_operand" "=m") ++ (unspec:V8HI [(match_operand:V8SF 1 "register_operand" "v") ++ (match_operand:SI 2 "const_0_to_255_operand" "N")] ++ UNSPEC_VCVTPS2PH))] ++ "TARGET_F16C || TARGET_AVX512VL" ++ "vcvtps2ph\t{%2, %1, %0|%0, %1, %2}" ++ [(set_attr "type" "ssecvt") ++ (set_attr "prefix" "maybe_evex") ++ (set_attr "btver2_decode" "vector") ++ (set_attr "mode" "V8SF")]) ++ + (define_insn "avx512f_vcvtps2ph512" +- [(set (match_operand:V16HI 0 "nonimmediate_operand" "=vm") ++ [(set (match_operand:V16HI 0 "register_operand" "=v") + (unspec:V16HI + [(match_operand:V16SF 1 "register_operand" "v") + (match_operand:SI 2 "const_0_to_255_operand" "N")] +@@ -21389,6 +21401,18 @@ + (set_attr "prefix" "evex") + (set_attr "mode" "V16SF")]) + ++(define_insn "*avx512f_vcvtps2ph512" ++ [(set (match_operand:V16HI 0 "memory_operand" "=m") ++ (unspec:V16HI ++ [(match_operand:V16SF 1 "register_operand" "v") ++ (match_operand:SI 2 "const_0_to_255_operand" "N")] ++ UNSPEC_VCVTPS2PH))] ++ "TARGET_AVX512F" ++ "vcvtps2ph\t{%2, %1, %0|%0, %1, %2}" ++ [(set_attr "type" "ssecvt") ++ (set_attr "prefix" "evex") ++ (set_attr "mode" "V16SF")]) ++ + ;; For gather* insn patterns + (define_mode_iterator VEC_GATHER_MODE + [V2DI V2DF V4DI V4DF V4SI V4SF V8SI V8SF]) +diff --git a/gcc/config/i386/subst.md b/gcc/config/i386/subst.md +index 4a1c9b080..27eb3430d 100644 +--- a/gcc/config/i386/subst.md ++++ b/gcc/config/i386/subst.md +@@ -75,6 +75,18 @@ + (match_operand:SUBST_V 2 "nonimm_or_0_operand" "0C") + (match_operand: 3 "register_operand" "Yk")))]) + ++(define_subst_attr "merge_mask_name" "merge_mask" "" "_merge_mask") ++(define_subst_attr "merge_mask_operand3" "merge_mask" "" "%{%3%}") ++(define_subst "merge_mask" ++ [(set (match_operand:SUBST_V 0) ++ (match_operand:SUBST_V 1))] ++ "TARGET_AVX512F" ++ [(set (match_dup 0) ++ (vec_merge:SUBST_V ++ (match_dup 1) ++ (match_dup 0) ++ (match_operand: 2 "register_operand" "Yk")))]) ++ + (define_subst_attr "mask_scalar_merge_name" "mask_scalar_merge" "" "_mask") + (define_subst_attr "mask_scalar_merge_operand3" "mask_scalar_merge" "" "%{%3%}") + (define_subst_attr "mask_scalar_merge_operand4" "mask_scalar_merge" "" "%{%4%}") +diff --git a/gcc/testsuite/gcc.target/i386/avx512f-vcvtps2ph-pr95254.c b/gcc/testsuite/gcc.target/i386/avx512f-vcvtps2ph-pr95254.c +new file mode 100644 +index 000000000..9e0da9473 +--- /dev/null ++++ b/gcc/testsuite/gcc.target/i386/avx512f-vcvtps2ph-pr95254.c +@@ -0,0 +1,12 @@ ++/* { dg-do compile } */ ++/* { dg-options "-O2 -mavx512f" } */ ++ ++#include ++extern __m256i res; ++void ++foo (__m512 a, __mmask16 m) ++{ ++ res = _mm512_maskz_cvtps_ph (m, a, 10); ++} ++ ++/* { dg-final { scan-assembler-not "vcvtps2ph\[ \\t\]+\[^\{\n\]*%zmm\[0-9\]\[^\n\]*res\[^\n\]*\{%k\[1-7\]\}\{z\}(?:\n|\[ \\t\]+#)"} } */ +diff --git a/gcc/testsuite/gcc.target/i386/avx512vl-vcvtps2ph-pr95254.c b/gcc/testsuite/gcc.target/i386/avx512vl-vcvtps2ph-pr95254.c +new file mode 100644 +index 000000000..0c685ea66 +--- /dev/null ++++ b/gcc/testsuite/gcc.target/i386/avx512vl-vcvtps2ph-pr95254.c +@@ -0,0 +1,18 @@ ++/* { dg-do compile } */ ++/* { dg-options "-O2 -mavx512vl -mavx512f" } */ ++ ++#include ++extern __m128i res; ++void ++foo (__m256 a, __mmask8 m) ++{ ++ res = _mm256_maskz_cvtps_ph (m, a, 10); ++} ++ ++void ++foo1 (__m128 a, __mmask8 m) ++{ ++ res = _mm_maskz_cvtps_ph (m, a, 10); ++} ++ ++/* { dg-final { scan-assembler-not "vcvtps2ph\[ \\t\]+\[^\{\n\]*%\[xy\]mm\[0-9\]\[^\n\]*res\[^\n\]*\{%k\[1-7\]\}\{z\}(?:\n|\[ \\t\]+#)"} } */ +-- +2.33.0 + diff --git a/gcc.spec b/gcc.spec index a913bb201ad9680163f78c1d25f6da4e49b7a01c..43dcfa356d005e66f65b6f0f56503df24cf7b79a 100644 --- a/gcc.spec +++ b/gcc.spec @@ -61,7 +61,7 @@ Summary: Various compilers (C, C++, Objective-C, ...) Name: gcc Version: %{gcc_version} -Release: 15 +Release: 16 License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ with exceptions and LGPLv2+ and BSD URL: https://gcc.gnu.org @@ -154,6 +154,9 @@ Patch39: 0039-libsanitizer-Fixup-pr59063-2-link-error.patch Patch40: 0040-libstdc-Fixup-pthread_join-weak-define-after-glibc-2.patch Patch41: 0041-add-missed-headers.patch %endif +Patch42: 0042-Struct-Reorg-Fix-speccpu2006-462-double-free-I60YUV.patch +Patch43: 0043-bogus-Wstringop-overflow-with-VLA-of-elements-larger.patch +Patch44: 0044-Backport-Fix-zero-masking-for-vcvtps2ph-when-dest-op.patch %global gcc_target_platform %{_arch}-linux-gnu @@ -638,7 +641,9 @@ not stable, so plugins must be rebuilt any time GCC is updated. %patch40 -p1 %patch41 -p1 %endif - +%patch42 -p1 +%patch43 -p1 +%patch44 -p1 %build @@ -2617,6 +2622,12 @@ end %doc rpm.doc/changelogs/libcc1/ChangeLog* %changelog +* Fri June 16 2023 liyancheng <412998149@qq.com> - 10.3.1-16 +- Type:Sync bugfix +- ID:NA +- SUG:NA +- DESC:Sync bugfix from openEuler-22.03-LTS-SP2 + * Wed Apr 12 2023 huangxiaoquan - 10.3.1-15 - Type:enhancement - ID:NA