[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: d6e1bf3168cce755396a408032b4804a7a527d43 Author: Sergei Trofimovich gentoo org> AuthorDate: Wed Nov 4 00:03:31 2020 + Commit: Sergei Trofimovich gentoo org> CommitDate: Wed Nov 4 07:26:02 2020 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=d6e1bf31 10.2.0: cut 4 patchset Single new patch: + 40_all_ipa-to_frequency.patch: fix ICE on empty profile merges. Bug: https://bugs.gentoo.org/746578 Bug: https://gcc.gnu.org/PR97295 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/README.history | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index e419e62..e0207e7 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -1,4 +1,4 @@ -4 TODO +4 04 Nov 2020 + 40_all_ipa-to_frequency.patch 3 02 Oct 2020
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: 50322c7c5fb8f869f45f8dd23a89f4a7c4b8ba2d Author: Sergei Trofimovich gentoo org> AuthorDate: Thu Apr 8 19:36:03 2021 + Commit: Sergei Trofimovich gentoo org> CommitDate: Thu Apr 8 19:36:03 2021 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=50322c7c 10.2.0: revert "port binutils fix for CET detection on i486" The patch is not ready for prime time. Le't pull newer upstream version a bit later. This reverts commit 5600e4343f36e2a4925b09388d3ffe7400143b9f. Reported-by: Worx Bug: https://bugs.gentoo.org/777117 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/44_all_cet-i486.patch | 109 10.2.0/gentoo/README.history| 1 - 2 files changed, 110 deletions(-) diff --git a/10.2.0/gentoo/44_all_cet-i486.patch b/10.2.0/gentoo/44_all_cet-i486.patch deleted file mode 100644 index 956e439..000 --- a/10.2.0/gentoo/44_all_cet-i486.patch +++ /dev/null @@ -1,109 +0,0 @@ -https://bugs.gentoo.org/777117 - -From 267a609477624ade477994b24809a72eeb522ff1 Mon Sep 17 00:00:00 2001 -From: "H.J. Lu via Gcc-patches" -Date: Sun, 14 Feb 2021 09:26:40 -0800 -Subject: [PATCH 2/2] GCC_CET_HOST_FLAGS: Check if host supports multi-byte - NOPs - -Check if host supports multi-byte NOPs before enabling CET on host. - -config/ - - PR binutils/27397 - * cet.m4 (GCC_CET_HOST_FLAGS): Check if host supports multi-byte - NOPs. - -libiberty/ - - PR binutils/27397 - * configure: Regenerated. - - config/cet.m4 | 19 --- - libiberty/configure | 29 + - 2 files changed, 45 insertions(+), 3 deletions(-) - a/config/cet.m4 -+++ b/config/cet.m4 -@@ -130,6 +130,18 @@ fi - if test x$may_have_cet = xyes; then - if test x$cross_compiling = xno; then - AC_TRY_RUN([ -+int -+main () -+{ -+ asm ("endbr32"); -+ return 0; -+} -+], -+[have_multi_byte_nop=yes], -+[have_multi_byte_nop=no]) -+have_cet=no -+if test x$have_multi_byte_nop = xyes; then -+ AC_TRY_RUN([ - static void - foo (void) - { -@@ -155,9 +167,10 @@ main () - bar (); - return 0; - } --], --[have_cet=no], --[have_cet=yes]) -+ ], -+ [have_cet=no], -+ [have_cet=yes]) -+fi - if test x$enable_cet = xno -a x$have_cet = xyes; then - AC_MSG_ERROR([Intel CET must be enabled on Intel CET enabled host]) - fi a/libiberty/configure -+++ b/libiberty/configure -@@ -5396,6 +5396,34 @@ else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext - /* end confdefs.h. */ - -+int -+main () -+{ -+ asm ("endbr32"); -+ return 0; -+} -+ -+_ACEOF -+if ac_fn_c_try_run "$LINENO"; then : -+ have_multi_byte_nop=yes -+else -+ have_multi_byte_nop=no -+fi -+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ -+ conftest.$ac_objext conftest.beam conftest.$ac_ext -+fi -+ -+have_cet=no -+if test x$have_multi_byte_nop = xyes; then -+ if test "$cross_compiling" = yes; then : -+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -+as_fn_error $? "cannot run test program while cross compiling -+See \`config.log' for more details" "$LINENO" 5; } -+else -+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext -+/* end confdefs.h. */ -+ - static void - foo (void) - { -@@ -5432,6 +5460,7 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext - fi - -+fi - if test x$enable_cet = xno -a x$have_cet = xyes; then - as_fn_error $? "Intel CET must be enabled on Intel CET enabled host" "$LINENO" 5 - fi --- -2.31.0 - diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index f47a108..f195ae9 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -1,7 +1,6 @@ 7 TODO + 42_all_vmat-PR97236.patch + 43_all_vtv-slibtool.patch - + 44_all_cet-i486.patch 6 29 Dec 2020 - 34_all_fundecl-ICE-PR95820.patch
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: 5600e4343f36e2a4925b09388d3ffe7400143b9f Author: Sergei Trofimovich gentoo org> AuthorDate: Fri Mar 19 08:01:22 2021 + Commit: Sergei Trofimovich gentoo org> CommitDate: Fri Mar 19 08:01:22 2021 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=5600e434 10.2.0: port binutils fix for CET detection on i486 Reported-by: Worx Bug: https://bugs.gentoo.org/777117 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/44_all_cet-i486.patch | 109 10.2.0/gentoo/README.history| 1 + 2 files changed, 110 insertions(+) diff --git a/10.2.0/gentoo/44_all_cet-i486.patch b/10.2.0/gentoo/44_all_cet-i486.patch new file mode 100644 index 000..956e439 --- /dev/null +++ b/10.2.0/gentoo/44_all_cet-i486.patch @@ -0,0 +1,109 @@ +https://bugs.gentoo.org/777117 + +From 267a609477624ade477994b24809a72eeb522ff1 Mon Sep 17 00:00:00 2001 +From: "H.J. Lu via Gcc-patches" +Date: Sun, 14 Feb 2021 09:26:40 -0800 +Subject: [PATCH 2/2] GCC_CET_HOST_FLAGS: Check if host supports multi-byte + NOPs + +Check if host supports multi-byte NOPs before enabling CET on host. + +config/ + + PR binutils/27397 + * cet.m4 (GCC_CET_HOST_FLAGS): Check if host supports multi-byte + NOPs. + +libiberty/ + + PR binutils/27397 + * configure: Regenerated. + +--- + config/cet.m4 | 19 --- + libiberty/configure | 29 + + 2 files changed, 45 insertions(+), 3 deletions(-) + +--- a/config/cet.m4 b/config/cet.m4 +@@ -130,6 +130,18 @@ fi + if test x$may_have_cet = xyes; then + if test x$cross_compiling = xno; then + AC_TRY_RUN([ ++int ++main () ++{ ++ asm ("endbr32"); ++ return 0; ++} ++], ++[have_multi_byte_nop=yes], ++[have_multi_byte_nop=no]) ++have_cet=no ++if test x$have_multi_byte_nop = xyes; then ++ AC_TRY_RUN([ + static void + foo (void) + { +@@ -155,9 +167,10 @@ main () + bar (); + return 0; + } +-], +-[have_cet=no], +-[have_cet=yes]) ++ ], ++ [have_cet=no], ++ [have_cet=yes]) ++fi + if test x$enable_cet = xno -a x$have_cet = xyes; then + AC_MSG_ERROR([Intel CET must be enabled on Intel CET enabled host]) + fi +--- a/libiberty/configure b/libiberty/configure +@@ -5396,6 +5396,34 @@ else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ + ++int ++main () ++{ ++ asm ("endbr32"); ++ return 0; ++} ++ ++_ACEOF ++if ac_fn_c_try_run "$LINENO"; then : ++ have_multi_byte_nop=yes ++else ++ have_multi_byte_nop=no ++fi ++rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ ++ conftest.$ac_objext conftest.beam conftest.$ac_ext ++fi ++ ++have_cet=no ++if test x$have_multi_byte_nop = xyes; then ++ if test "$cross_compiling" = yes; then : ++ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 ++$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} ++as_fn_error $? "cannot run test program while cross compiling ++See \`config.log' for more details" "$LINENO" 5; } ++else ++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext ++/* end confdefs.h. */ ++ + static void + foo (void) + { +@@ -5432,6 +5460,7 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext + fi + ++fi + if test x$enable_cet = xno -a x$have_cet = xyes; then + as_fn_error $? "Intel CET must be enabled on Intel CET enabled host" "$LINENO" 5 + fi +-- +2.31.0 + diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index f195ae9..f47a108 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -1,6 +1,7 @@ 7 TODO + 42_all_vmat-PR97236.patch + 43_all_vtv-slibtool.patch + + 44_all_cet-i486.patch 6 29 Dec 2020 - 34_all_fundecl-ICE-PR95820.patch
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: 8634da04f3f6214cc36ebfeba38c4f3fca4473be Author: Sergei Trofimovich gentoo org> AuthorDate: Thu Mar 4 10:59:30 2021 + Commit: Sergei Trofimovich gentoo org> CommitDate: Thu Mar 4 10:59:30 2021 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=8634da04 10.2.0: backport PR97236: fix bad use of VMAT_CONTIGUOUS Bug: https://gcc.gnu.org/PR97236 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/42_all_vmat-PR97236.patch | 116 10.2.0/gentoo/README.history| 3 + 2 files changed, 119 insertions(+) diff --git a/10.2.0/gentoo/42_all_vmat-PR97236.patch b/10.2.0/gentoo/42_all_vmat-PR97236.patch new file mode 100644 index 000..5a7643c --- /dev/null +++ b/10.2.0/gentoo/42_all_vmat-PR97236.patch @@ -0,0 +1,116 @@ +https://gcc.gnu.org/PR97236 + +From 1ab88985631dd2c5a5e3b5c0dce47cf8b6ed2f82 Mon Sep 17 00:00:00 2001 +From: Matthias Klose +Date: Tue, 6 Oct 2020 13:41:37 +0200 +Subject: [PATCH] Backport fix for PR/tree-optimization/97236 - fix bad use of + VMAT_CONTIGUOUS + +This avoids using VMAT_CONTIGUOUS with single-element interleaving +when using V1mode vectors. Instead keep VMAT_ELEMENTWISE but +continue to avoid load-lanes and gathers. + +2020-10-01 Richard Biener + + PR tree-optimization/97236 + * tree-vect-stmts.c (get_group_load_store_type): Keep + VMAT_ELEMENTWISE for single-element vectors. + + * gcc.dg/vect/pr97236.c: New testcase. +--- + gcc/testsuite/gcc.dg/vect/pr97236.c | 43 + + gcc/tree-vect-stmts.c | 20 ++ + 2 files changed, 52 insertions(+), 11 deletions(-) + create mode 100644 gcc/testsuite/gcc.dg/vect/pr97236.c + +diff --git a/gcc/testsuite/gcc.dg/vect/pr97236.c b/gcc/testsuite/gcc.dg/vect/pr97236.c +new file mode 100644 +index 000..9d3dc20d953 +--- /dev/null b/gcc/testsuite/gcc.dg/vect/pr97236.c +@@ -0,0 +1,43 @@ ++typedef unsigned char __uint8_t; ++typedef __uint8_t uint8_t; ++typedef struct plane_t { ++ uint8_t *p_pixels; ++ int i_lines; ++ int i_pitch; ++} plane_t; ++ ++typedef struct { ++ plane_t p[5]; ++} picture_t; ++ ++#define N 4 ++ ++void __attribute__((noipa)) ++picture_Clone(picture_t *picture, picture_t *res) ++{ ++ for (int i = 0; i < N; i++) { ++res->p[i].p_pixels = picture->p[i].p_pixels; ++res->p[i].i_lines = picture->p[i].i_lines; ++res->p[i].i_pitch = picture->p[i].i_pitch; ++ } ++} ++ ++int ++main() ++{ ++ picture_t aaa, bbb; ++ uint8_t pixels[10] = {1, 1, 1, 1, 1, 1, 1, 1}; ++ ++ for (unsigned i = 0; i < N; i++) ++aaa.p[i].p_pixels = pixels; ++ ++ picture_Clone (&aaa, &bbb); ++ ++ uint8_t c = 0; ++ for (unsigned i = 0; i < N; i++) ++c += bbb.p[i].p_pixels[0]; ++ ++ if (c != N) ++__builtin_abort (); ++ return 0; ++} +diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c +index 9ace345fc5e..d8b2ff3d6ee 100644 +--- a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c +@@ -2413,25 +2413,23 @@ get_group_load_store_type (stmt_vec_info stmt_info, tree vectype, bool slp, + /* First cope with the degenerate case of a single-element +vector. */ + if (known_eq (TYPE_VECTOR_SUBPARTS (vectype), 1U)) +- *memory_access_type = VMAT_CONTIGUOUS; ++ ; + + /* Otherwise try using LOAD/STORE_LANES. */ +-if (*memory_access_type == VMAT_ELEMENTWISE +-&& (vls_type == VLS_LOAD +-? vect_load_lanes_supported (vectype, group_size, masked_p) +-: vect_store_lanes_supported (vectype, group_size, +- masked_p))) ++else if (vls_type == VLS_LOAD ++ ? vect_load_lanes_supported (vectype, group_size, masked_p) ++ : vect_store_lanes_supported (vectype, group_size, ++ masked_p)) + { + *memory_access_type = VMAT_LOAD_STORE_LANES; + overrun_p = would_overrun_p; + } + + /* If that fails, try using permuting loads. */ +-if (*memory_access_type == VMAT_ELEMENTWISE +-&& (vls_type == VLS_LOAD +-? vect_grouped_load_supported (vectype, single_element_p, +- group_size) +-: vect_grouped_store_supported (vectype, group_size))) ++else if (vls_type == VLS_LOAD ++ ? vect_grouped_load_supported (vectype, single_element_p, ++group_size) ++ : vect_grouped_store_supported (vectype, group_size)) + { + *memory_access_type = VMAT_CONTIGUOUS_PERMUTE; + overrun_p = would_overrun_p; +-- +2.30.1 + diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index 48587e1..4ca261a 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -1,3 +1,6 @
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: ff3a446afb9e0abb87869e85826454e85ef398c3 Author: Sergei Trofimovich gentoo org> AuthorDate: Mon Mar 15 22:55:21 2021 + Commit: Sergei Trofimovich gentoo org> CommitDate: Mon Mar 15 22:57:07 2021 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=ff3a446a 10.2.0: fix vtv build on slibtool Reported-by: orbea riseup.net Bug: https://gcc.gnu.org/PR99172 Bug: https://bugs.gentoo.org/767706 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/43_all_vtv-slibtool.patch | 62 + 10.2.0/gentoo/README.history| 1 + 2 files changed, 63 insertions(+) diff --git a/10.2.0/gentoo/43_all_vtv-slibtool.patch b/10.2.0/gentoo/43_all_vtv-slibtool.patch new file mode 100644 index 000..b5716f9 --- /dev/null +++ b/10.2.0/gentoo/43_all_vtv-slibtool.patch @@ -0,0 +1,62 @@ +https://bugs.gentoo.org/767706 +https://gcc.gnu.org/PR99172 + +From c2be82058fb40f3ae891c68d185ff53e07f14f45 Mon Sep 17 00:00:00 2001 +From: Caroline Tice +Date: Fri, 12 Mar 2021 07:34:36 -0800 +Subject: [PATCH] libstdc++-v3: Update VTV vars for libtool link commands + [PR99172] + +This fixes PR 99172 + +Currently when GCC is configured with --enable-vtable-verify, the +libstdc++-v3 Makefiles add "-fvtable-verify=std +-Wl,-u_vtable_map_vars_start,-u_vtable_map_vars_end" to libtool link +commands. The "-fvtable-verify=std" piece causes alternate versions of +libtool (such as slibtool) to fail, unable to find "-lvtv" (GNU +libtool just removes that piece). + +This patch updates the libstdc++-v3 Makefiles to not pass +"-fvtable-verify=std" to the libtool link commands. +--- + libstdc++-v3/src/Makefile.am | 4 +++- + libstdc++-v3/src/Makefile.in | 3 ++- + +--- a/libstdc++-v3/src/Makefile.am b/libstdc++-v3/src/Makefile.am +@@ -214,12 +214,14 @@ compatibility-condvar.o: compatibility-condvar.cc + # set this option because CONFIG_CXXFLAGS has to be after + # OPTIMIZE_CXXFLAGS on the compile line so that -O2 can be overridden + # as the occasion calls for it. +-AM_CXXFLAGS = \ ++AM_CXXFLAGS_PRE = \ + -std=gnu++98 \ + $(glibcxx_compiler_pic_flag) \ + $(XTEMPLATE_FLAGS) $(VTV_CXXFLAGS) \ + $(WARN_CXXFLAGS) $(OPTIMIZE_CXXFLAGS) $(CONFIG_CXXFLAGS) + ++AM_CXXFLAGS = $(filter-out -fvtable-verify=std,$(AM_CXXFLAGS_PRE)) ++ + # Libtool notes + + # 1) In general, libtool expects an argument such as `--tag=CXX' when +--- a/libstdc++-v3/src/Makefile.in b/libstdc++-v3/src/Makefile.in +@@ -578,12 +578,13 @@ libstdc___la_LINK = $(CXXLINK) $(libstdc___la_LDFLAGS) $(lt_host_flags) + # set this option because CONFIG_CXXFLAGS has to be after + # OPTIMIZE_CXXFLAGS on the compile line so that -O2 can be overridden + # as the occasion calls for it. +-AM_CXXFLAGS = \ ++AM_CXXFLAGS_PRE = \ + -std=gnu++98 \ + $(glibcxx_compiler_pic_flag) \ + $(XTEMPLATE_FLAGS) $(VTV_CXXFLAGS) \ + $(WARN_CXXFLAGS) $(OPTIMIZE_CXXFLAGS) $(CONFIG_CXXFLAGS) + ++AM_CXXFLAGS = $(filter-out -fvtable-verify=std,$(AM_CXXFLAGS_PRE)) + + # Libtool notes + +-- +2.30.2 + diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index 4ca261a..f195ae9 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -1,5 +1,6 @@ 7 TODO + 42_all_vmat-PR97236.patch + + 43_all_vtv-slibtool.patch 6 29 Dec 2020 - 34_all_fundecl-ICE-PR95820.patch
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: bb00f570a7d3f1d0e4233f8d353fb9c56f3a55cc Author: Sergei Trofimovich gentoo org> AuthorDate: Thu Sep 10 21:37:36 2020 + Commit: Sergei Trofimovich gentoo org> CommitDate: Thu Sep 10 21:37:36 2020 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=bb00f570 10.2.0: fix TOPN counters when logged from shared library The change does not yet fix underlying problem of recursive inliner. Bug: https://gcc.gnu.org/PR96913 Bug: https://gcc.gnu.org/PR96394 Bug: https://bugs.gentoo.org/734006 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/38_all_gcov-TOPN-PR96913.patch | 42 10.2.0/gentoo/README.history | 1 + 2 files changed, 43 insertions(+) diff --git a/10.2.0/gentoo/38_all_gcov-TOPN-PR96913.patch b/10.2.0/gentoo/38_all_gcov-TOPN-PR96913.patch new file mode 100644 index 000..5c301e4 --- /dev/null +++ b/10.2.0/gentoo/38_all_gcov-TOPN-PR96913.patch @@ -0,0 +1,42 @@ +https://gcc.gnu.org/PR96913 +https://gcc.gnu.org/PR96394 +https://bugs.gentoo.org/734006 + +From ae887148e112e018bec0bab5bc15e53f2225037a Mon Sep 17 00:00:00 2001 +From: Sergei Trofimovich +Date: Sun, 6 Sep 2020 12:13:54 +0100 +Subject: [PATCH] gcov: fix TOPN streaming from shared libraries + +Before the change gcc did not stream correctly TOPN counters +if counters belonged to a non-local shared object. + +As a result zero-section optimization generated TOPN sections +in a form not recognizable by '__gcov_merge_topn'. + +The problem happens because in a case of multiple shared objects +'__gcov_merge_topn' function is present in address space multiple +times (once per each object). + +The fix is to never rely on function address and predicate on TOPN +counter types. + +libgcc/ChangeLog: + + PR gcov-profile/96913 + * libgcov-driver.c (write_one_data): Avoid function pointer + comparison in TOP streaming decision. +--- + libgcc/libgcov-driver.c | 7 ++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +--- a/libgcc/libgcov-driver.c b/libgcc/libgcov-driver.c +@@ -242,7 +242,7 @@ prune_counters (struct gcov_info *gi) + if (gi->merge[j] == NULL) + continue; + +-if (gi->merge[j] == __gcov_merge_topn) ++if (j == GCOV_COUNTER_V_TOPN || j == GCOV_COUNTER_V_INDIR) + { + gcc_assert (!(ci->num % GCOV_TOPN_VALUES_COUNTERS)); + for (unsigned k = 0; k < (ci->num / GCOV_TOPN_VALUES_COUNTERS); diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index 3fbcbfd..6d00c5a 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -1,6 +1,7 @@ 3 TODO U 28_all_EXTRA_OPTIONS-fstack-clash-protection.patch + 37_all_c-vector-init-PR96377.patch + + 38_all_gcov-TOPN-PR96913.patch 2 23 Aug 2020 + 33_all_lto-O0-mix-ICE-ipa-PR96291.patch
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: bb31009f6bb62d2dbee6a4be9605c9286ef0df23 Author: Sergei Trofimovich gentoo org> AuthorDate: Thu Oct 15 17:30:51 2020 + Commit: Sergei Trofimovich gentoo org> CommitDate: Thu Oct 15 17:30:51 2020 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=bb31009f 10.2.0: backport IPA to_frequency() ICE Reported-by: inasprecali disroot.org Bug: https://bugs.gentoo.org/746578 Bug: https://gcc.gnu.org/PR97295 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/40_all_ipa-to_frequency.patch | 48 + 10.2.0/gentoo/README.history| 3 ++ 2 files changed, 51 insertions(+) diff --git a/10.2.0/gentoo/40_all_ipa-to_frequency.patch b/10.2.0/gentoo/40_all_ipa-to_frequency.patch new file mode 100644 index 000..0849207 --- /dev/null +++ b/10.2.0/gentoo/40_all_ipa-to_frequency.patch @@ -0,0 +1,48 @@ +https://bugs.gentoo.org/746578 +https://gcc.gnu.org/PR97295 + +From 508e2d88a4c512e8b8685cf5ba201ad48e6bb58d Mon Sep 17 00:00:00 2001 +From: Martin Liska +Date: Tue, 13 Oct 2020 16:44:47 +0200 +Subject: [PATCH] IPA: fix profile handling in IRA + +gcc/ChangeLog: + + PR ipa/97295 + * profile-count.c (profile_count::to_frequency): Move part of + gcc_assert to STATIC_ASSERT. + * regs.h (REG_FREQ_FROM_BB): Do not use count.to_frequency for + a function that does not have count_max initialized. +--- + gcc/profile-count.c | 4 ++-- + gcc/regs.h | 3 ++- + 2 files changed, 4 insertions(+), 3 deletions(-) + +--- a/gcc/profile-count.c b/gcc/profile-count.c +@@ -270,8 +270,8 @@ profile_count::to_frequency (struct function *fun) const + return BB_FREQ_MAX; + if (*this == zero ()) + return 0; +- gcc_assert (REG_BR_PROB_BASE == BB_FREQ_MAX +-&& fun->cfg->count_max.initialized_p ()); ++ STATIC_ASSERT (REG_BR_PROB_BASE == BB_FREQ_MAX); ++ gcc_assert (fun->cfg->count_max.initialized_p ()); + profile_probability prob = probability_in (fun->cfg->count_max); + if (!prob.initialized_p ()) + return REG_BR_PROB_BASE; +--- a/gcc/regs.h b/gcc/regs.h +@@ -128,7 +128,8 @@ extern size_t reg_info_p_size; +or profile driven feedback is available and the function is never executed, +frequency is always equivalent. Otherwise rescale the basic block +frequency. */ +-#define REG_FREQ_FROM_BB(bb) (optimize_function_for_size_p (cfun) \ ++#define REG_FREQ_FROM_BB(bb) ((optimize_function_for_size_p (cfun) \ ++ || !cfun->cfg->count_max.initialized_p ()) \ + ? REG_FREQ_MAX \ + : ((bb)->count.to_frequency (cfun) \ + * REG_FREQ_MAX / BB_FREQ_MAX) \ +-- +2.28.0 + diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index 86f3aae..e419e62 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -1,3 +1,6 @@ +4 TODO + + 40_all_ipa-to_frequency.patch + 3 02 Oct 2020 U 28_all_EXTRA_OPTIONS-fstack-clash-protection.patch + 37_all_c-vector-init-PR96377.patch
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: 7bf989ed8b53a13de6a6551b7f346b1dcadf5966 Author: Sergei Trofimovich gentoo org> AuthorDate: Fri Oct 2 09:12:10 2020 + Commit: Sergei Trofimovich gentoo org> CommitDate: Fri Oct 2 09:12:10 2020 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=7bf989ed 10.2.0: fix multiple speculation resolution on prog builds Reported-by: Ștefan Talpalaru Bug: https://gcc.gnu.org/PR96394 Bug: https://bugs.gentoo.org/734006 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/39_all_ipa-prop-multispec.patch | 150 ++ 10.2.0/gentoo/README.history | 1 + 2 files changed, 151 insertions(+) diff --git a/10.2.0/gentoo/39_all_ipa-prop-multispec.patch b/10.2.0/gentoo/39_all_ipa-prop-multispec.patch new file mode 100644 index 000..6e19992 --- /dev/null +++ b/10.2.0/gentoo/39_all_ipa-prop-multispec.patch @@ -0,0 +1,150 @@ +https://gcc.gnu.org/PR96394 +https://bugs.gentoo.org/734006 + +From 7f790f414ec38581b9bb033ab64e4ad12b9f8a4c Mon Sep 17 00:00:00 2001 +From: Martin Jambor +Date: Thu, 1 Oct 2020 19:39:27 +0200 +Subject: [PATCH] ipa-prop: Fix multiple-target speculation resolution + +Hi, + +as the FIXME which this patch removes states, the current code does +not work when a call with multiple speculative targets gets resolved +through parameter tracking during inlining - it feeds the inliner an +edge it has already dealt with. The patch makes the code which should +prevent it aware of the possibility that that speculation can have +more than one target now. + +Bootstrapped and tested and LTO bootstrapped on x86_64-linux. I did not +try profiled LTO bootstrap because it fails even without the patch (even +without Ada, just C, C++ and Fortran, at least commit 92f0d3d03a7 does). +OK for trunk? + +Thanks, + +Martin + +gcc/ChangeLog: + +2020-09-30 Martin Jambor + + PR ipa/96394 + * ipa-prop.c (update_indirect_edges_after_inlining): Do not add + resolved speculation edges to vector of new direct edges even in + presence of multiple speculative direct edges for a single call. + +gcc/testsuite/ChangeLog: + +2020-09-30 Martin Jambor + + PR ipa/96394 + * gcc.dg/tree-prof/pr96394.c: New test. +--- + gcc/ipa-prop.c | 10 ++-- + gcc/testsuite/gcc.dg/tree-prof/pr96394.c | 64 + 2 files changed, 70 insertions(+), 4 deletions(-) + create mode 100644 gcc/testsuite/gcc.dg/tree-prof/pr96394.c + +diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c +index ea88fd3fd95..0ff04d344e1 100644 +--- a/gcc/ipa-prop.c b/gcc/ipa-prop.c +@@ -3787,11 +3787,13 @@ update_indirect_edges_after_inlining (struct cgraph_edge *cs, + + param_index = ici->param_index; + jfunc = ipa_get_ith_jump_func (top, param_index); +- cgraph_node *spec_target = NULL; + +- /* FIXME: This may need updating for multiple calls. */ ++ auto_vec spec_targets; + if (ie->speculative) +- spec_target = ie->first_speculative_call_target ()->callee; ++ for (cgraph_edge *direct = ie->first_speculative_call_target (); ++ direct; ++ direct = direct->next_speculative_call_target ()) ++spec_targets.safe_push (direct->callee); + + if (!opt_for_fn (node->decl, flag_indirect_inlining)) + new_direct_edge = NULL; +@@ -3814,7 +3816,7 @@ update_indirect_edges_after_inlining (struct cgraph_edge *cs, + + /* If speculation was removed, then we need to do nothing. */ + if (new_direct_edge && new_direct_edge != ie +-&& new_direct_edge->callee == spec_target) ++&& spec_targets.contains (new_direct_edge->callee)) + { + new_direct_edge->indirect_inlining_edge = 1; + top = IPA_EDGE_REF (cs); +diff --git a/gcc/testsuite/gcc.dg/tree-prof/pr96394.c b/gcc/testsuite/gcc.dg/tree-prof/pr96394.c +new file mode 100644 +index 000..4280182a7c3 +--- /dev/null b/gcc/testsuite/gcc.dg/tree-prof/pr96394.c +@@ -0,0 +1,64 @@ ++/* PR ipa/96394 */ ++/* { dg-options "-O2" } */ ++ ++typedef struct _entry { ++int has_next; ++int next_ix; ++int count; ++} entry; ++ ++extern entry table[]; ++ ++void * ++__attribute__((noipa)) ++PyErr_Format(entry * e){ return 0; } ++ ++void ae(entry *); ++int h(entry *); ++int ap(entry *); ++int ag(entry *); ++ ++int ag(entry *j) { ++ if (j->has_next) ++h(&table[j->next_ix]); ++ return 0; ++} ++static int ai(entry *j, int k(entry *), int l, int m) { ++ int am = 1; ++ int ab; ++ ++ /* k is either 'h' or 'ap': 50%/50% */ ++ ab = k(j); ++ ++ /* loop never gets executed on real data */ ++ for (; j->count >= 2; am += 2) ++if (l) { ++ entry *i = &table[am + m]; ++ PyErr_Format(i); ++} ++ return ab; ++} ++void ++__attribute__((noipa)) ++bug() { ++ h(table); ++ h(table); ++} ++int h(entry *j) { return ai(j, ap, 4, 5); } ++int ap(entry *j) { return ai(j, ag, 14, 4); } ++ ++int main(void) ++{ ++bug(); ++} ++ ++entry
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: b4972ce62b04aafc6061836a92f0cebbadd80d7a Author: Sergei Trofimovich gentoo org> AuthorDate: Fri Oct 2 09:22:40 2020 + Commit: Sergei Trofimovich gentoo org> CommitDate: Fri Oct 2 09:22:40 2020 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=b4972ce6 10.2.0: cut 3 patchset three new patches: + 37_all_c-vector-init-PR96377.patch: fix vector init on arm + 38_all_gcov-TOPN-PR96913.patch: fix TOPN prof counters in shared libraries + 39_all_ipa-prop-multispec.patch: fix multiple speculation resolution on prof builds Bug: https://gcc.gnu.org/PR96377 Bug: https://gcc.gnu.org/PR96913 Bug: https://bugs.gentoo.org/734006 Bug: https://gcc.gnu.org/PR96394 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/README.history | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index 5929aae..86f3aae 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -1,4 +1,4 @@ -3 TODO +3 02 Oct 2020 U 28_all_EXTRA_OPTIONS-fstack-clash-protection.patch + 37_all_c-vector-init-PR96377.patch + 38_all_gcov-TOPN-PR96913.patch
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: 7ecc76113ad46206cbe6e8bdc1ca39bee97be4dd Author: Sergei Trofimovich gentoo org> AuthorDate: Thu Sep 3 17:11:15 2020 + Commit: Sergei Trofimovich gentoo org> CommitDate: Thu Sep 3 17:11:15 2020 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=7ecc7611 10.2.0: backport PR96377 (c vector init syntax) Bug: https://gcc.gnu.org/PR96377 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/37_all_c-vector-init-PR96377.patch | 522 +++ 10.2.0/gentoo/README.history | 1 + 2 files changed, 523 insertions(+) diff --git a/10.2.0/gentoo/37_all_c-vector-init-PR96377.patch b/10.2.0/gentoo/37_all_c-vector-init-PR96377.patch new file mode 100644 index 000..7ef9cdd --- /dev/null +++ b/10.2.0/gentoo/37_all_c-vector-init-PR96377.patch @@ -0,0 +1,522 @@ +https://gcc.gnu.org/PR96377 + +From a216daaa30bc8949086a16e7656f2025b692d03c Mon Sep 17 00:00:00 2001 +From: Richard Sandiford +Date: Mon, 3 Aug 2020 09:48:36 +0100 +Subject: [PATCH] c: Fix bogus vector initialisation error [PR96377] + +One of the problems in this PR was that if we had: + + vector_type1 array[] = { vector_value1 }; + +process_init_element would only treat vector_value1 as initialising +a vector_type1 if they had the same TYPE_MAIN_VARIANT. This has +several problems: + +(1) It gives confusing error messages if the vector types are +incompatible. (Tested by gcc.dg/pr96377-1.c.) + +(2) It means that we reject code that should be valid with +-flax-vector-conversions. (Tested by gcc.dg/pr96377-2.c.) + +(3) On arm and aarch64 targets, it means that we reject some +initializers that mix Advanced SIMD and standard GNU vectors. +These vectors have traditionally had different TYPE_MAIN_VARIANTs +because they have different mangling schemes. (Tested by +gcc.dg/pr96377-[3-6].c.) + +(4) It means that we reject SVE initializers that should be valid. +(Tested by gcc.target/aarch64/sve/gnu_vectors_[34].c.) + +(5) After r11-1741-g:31427b974ed7b7dd54e2 we reject: + + arm_neon_type1 array[] = { k ^ arm_neon_value1 }; + +because applying the binary operator to arm_neon_value1 strips +the "Advanced SIMD type" attributes that were added in that patch. +Stripping the attributes is problematic for other reasons though, +so that still needs to be fixed separately. + +g++.target/aarch64/sve/gnu_vectors_[34].C already pass. + +gcc/c/ + PR c/96377 + * c-typeck.c (process_init_element): Split test for whether to + recurse into a record, union or array into... + (initialize_elementwise_p): ...this new function. Don't recurse + into a vector type if the initialization value is also a vector. + +gcc/testsuite/ + PR c/96377 + * gcc.dg/pr96377-1.c: New test. + * gcc.dg/pr96377-2.c: Likewise. + * gcc.dg/pr96377-3.c: Likewise. + * gcc.dg/pr96377-4.c: Likewise. + * gcc.dg/pr96377-5.c: Likewise. + * gcc.dg/pr96377-6.c: Likewise. + * gcc.target/aarch64/pr96377-1.c: Likewise. + * gcc.target/aarch64/sve/acle/general-c/gnu_vectors_3.c: Likewise. + * gcc.target/aarch64/sve/acle/general-c/gnu_vectors_4.c: Likewise. + * g++.target/aarch64/sve/acle/general-c++/gnu_vectors_3.C: Likewise. + * g++.target/aarch64/sve/acle/general-c++/gnu_vectors_4.C: Likewise. + +(cherry picked from commit 7d599ad27b9bcf5165f87710f1abc64bbabd06ae) +--- + gcc/c/c-typeck.c | 59 ++- + .../sve/acle/general-c++/gnu_vectors_3.C | 15 + + .../sve/acle/general-c++/gnu_vectors_4.C | 15 + + gcc/testsuite/gcc.dg/pr96377-1.c | 32 ++ + gcc/testsuite/gcc.dg/pr96377-2.c | 31 ++ + gcc/testsuite/gcc.dg/pr96377-3.c | 33 +++ + gcc/testsuite/gcc.dg/pr96377-4.c | 32 ++ + gcc/testsuite/gcc.dg/pr96377-5.c | 33 +++ + gcc/testsuite/gcc.dg/pr96377-6.c | 32 ++ + gcc/testsuite/gcc.target/aarch64/pr96377-1.c | 20 +++ + .../sve/acle/general-c/gnu_vectors_3.c| 15 + + .../sve/acle/general-c/gnu_vectors_4.c| 15 + + 12 files changed, 317 insertions(+), 15 deletions(-) + create mode 100644 gcc/testsuite/g++.target/aarch64/sve/acle/general-c++/gnu_vectors_3.C + create mode 100644 gcc/testsuite/g++.target/aarch64/sve/acle/general-c++/gnu_vectors_4.C + create mode 100644 gcc/testsuite/gcc.dg/pr96377-1.c + create mode 100644 gcc/testsuite/gcc.dg/pr96377-2.c + create mode 100644 gcc/testsuite/gcc.dg/pr96377-3.c + create mode 100644 gcc/testsuite/gcc.dg/pr96377-4.c + create mode 100644 gcc/testsuite/gcc.dg/pr96377-5.c + create mode 100644 gcc/testsuite/gcc.dg/pr96377-6.c + create mode 100644 gcc/testsuite/gcc.target/aarch64/pr96377-1.c + create mode 100644 gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/gnu_vectors_3.c + create mode 100644 gcc/testsuite/gcc.target/aarch64/sve
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: c446f6f37e5a5f0867527acdb0b78333e3b70822 Author: Sergei Trofimovich gentoo org> AuthorDate: Thu Aug 13 08:39:49 2020 + Commit: Sergei Trofimovich gentoo org> CommitDate: Thu Aug 13 08:39:49 2020 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=c446f6f3 10.2.0:backport ipa-cp bit fix (PR/96482) Reported-by: Johannes Hirte Bug: https://bugs.gentoo.org/736685 Bug: https://gcc.gnu.org/PR96482 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/35_all_ipa-fix-bit-CP.patch | 145 ++ 10.2.0/gentoo/README.history | 1 + 2 files changed, 146 insertions(+) diff --git a/10.2.0/gentoo/35_all_ipa-fix-bit-CP.patch b/10.2.0/gentoo/35_all_ipa-fix-bit-CP.patch new file mode 100644 index 000..34a1fe0 --- /dev/null +++ b/10.2.0/gentoo/35_all_ipa-fix-bit-CP.patch @@ -0,0 +1,145 @@ +https://bugs.gentoo.org/736685 +https://gcc.gnu.org/PR96482 + +From 66780083a0e79e5cb7c3acc8665aa47be4084a67 Mon Sep 17 00:00:00 2001 +From: Martin Liska +Date: Wed, 12 Aug 2020 09:21:51 +0200 +Subject: [PATCH] ipa: fix bit CPP when combined with IPA bit CP + +As mentioned in the PR, let's consider the following example: + +int +__attribute__((noinline)) +foo(int arg) +{ + if (arg == 3) +return 1; + if (arg == 4) +return 123; + + __builtin_unreachable (); +} + +during WPA we find all calls of the function +(yes the call with value 5 is UBSAN): + + Node: foo/0: +param [0]: 5 [loc_time: 4, loc_size: 2, prop_time: 0, prop_size: 0] + 3 [loc_time: 3, loc_size: 3, prop_time: 0, prop_size: 0] + ctxs: VARIABLE + Bits: value = 0x5, mask = 0x6 + +in LTRANS we have the following VRP info: + + # RANGE [3, 3] NONZERO 3 + +when we AND masks in get_default_value we end up with 6 & 3 = 2 (0x010). +That means the only second (least significant bit) is unknown and +value (5 = 0x101) & ~mask gives us either 7 (0x111) or 5 (0x101). + +That's why if (arg_2(D) == 3) gets optimized to false. + +gcc/ChangeLog: + + PR ipa/96482 + * ipa-cp.c (ipcp_bits_lattice::meet_with_1): Drop value bits + for bits that are unknown. + (ipcp_bits_lattice::set_to_constant): Likewise. + * tree-ssa-ccp.c (get_default_value): Add sanity check that + IPA CP bit info has all bits set to zero in bits that + are unknown. + +gcc/testsuite/ChangeLog: + + PR ipa/96482 + * gcc.dg/ipa/pr96482.c: New test. + +(cherry picked from commit d58f078ce2d53e5dab6b3d0d5f960504268e1894) +--- + gcc/ipa-cp.c | 3 +- + gcc/testsuite/gcc.dg/ipa/pr96482.c | 44 ++ + gcc/tree-ssa-ccp.c | 3 ++ + 3 files changed, 49 insertions(+), 1 deletion(-) + create mode 100644 gcc/testsuite/gcc.dg/ipa/pr96482.c + +--- a/gcc/ipa-cp.c b/gcc/ipa-cp.c +@@ -1010,7 +1010,7 @@ ipcp_bits_lattice::set_to_constant (widest_int value, widest_int mask) + { + gcc_assert (top_p ()); + m_lattice_val = IPA_BITS_CONSTANT; +- m_value = value; ++ m_value = wi::bit_and (wi::bit_not (mask), value); + m_mask = mask; + return true; + } +@@ -1047,6 +1047,7 @@ ipcp_bits_lattice::meet_with_1 (widest_int value, widest_int mask, + + widest_int old_mask = m_mask; + m_mask = (m_mask | mask) | (m_value ^ value); ++ m_value &= value; + + if (wi::sext (m_mask, precision) == -1) + return set_to_bottom (); +--- /dev/null b/gcc/testsuite/gcc.dg/ipa/pr96482.c +@@ -0,0 +1,44 @@ ++/* PR ipa/96482 */ ++/* { dg-do run } */ ++/* { dg-options "-O2 -flto" } */ ++/* { dg-require-effective-target lto } */ ++ ++int ++__attribute__((noinline)) ++foo(int arg) ++{ ++ if (arg == 3) ++return 1; ++ if (arg == 4) ++return 123; ++ ++ __builtin_unreachable (); ++} ++ ++int ++__attribute__((noinline)) ++baz(int x) ++{ ++ if (x != 0) ++return foo(3); /* called */ ++ ++ return 1; ++} ++ ++int ++__attribute__((noinline)) ++bar(int x) ++{ ++ if (x == 0) ++return foo(5); /* not executed */ ++ ++ return 1; ++} ++ ++int main(int argc, char **argv) ++{ ++ if (bar(argc) != baz(argc)) ++__builtin_abort (); ++ ++ return 0; ++} +--- a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c +@@ -306,6 +306,9 @@ get_default_value (tree var) + { + val.lattice_val = CONSTANT; + val.value = value; ++widest_int ipa_value = wi::to_widest (value); ++/* Unknown bits from IPA CP must be equal to zero. */ ++gcc_assert (wi::bit_and (ipa_value, mask) == 0); + val.mask = mask; + if (nonzero_bits != -1) + val.mask &= extend_mask (nonzero_bits, +-- +2.28.0 + diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index 7cde6a3..49edda3 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -1,6 +1,7 @@ 2 TODO + 33_all_lto-O0-mix-ICE-ipa-PR96291.patch + 34_all_fundecl-I
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: 7adab39a82fd07085f600603bdc5c440aa1c142a Author: Sergei Trofimovich gentoo org> AuthorDate: Tue Dec 29 09:51:52 2020 + Commit: Sergei Trofimovich gentoo org> CommitDate: Tue Dec 29 09:51:52 2020 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=7adab39a 10.2.0: revert PR95820 backporting The backport breaks parsing as seen in https://gcc.gnu.org/PR98441 Bug: https://gcc.gnu.org/PR95820 Bug: https://bugs.gentoo.org/730406 Reported-by: Daniel Santos Bug: https://gcc.gnu.org/PR98441 Bug: https://bugs.gentoo.org/762382 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/34_all_fundecl-ICE-PR95820.patch | 25 - 10.2.0/gentoo/README.history | 3 +++ 2 files changed, 3 insertions(+), 25 deletions(-) diff --git a/10.2.0/gentoo/34_all_fundecl-ICE-PR95820.patch b/10.2.0/gentoo/34_all_fundecl-ICE-PR95820.patch deleted file mode 100644 index e365420..000 --- a/10.2.0/gentoo/34_all_fundecl-ICE-PR95820.patch +++ /dev/null @@ -1,25 +0,0 @@ -It's an unofficial backport of PR95820 where gcc ICEs on -invalid syntax. As creduce frequently end up in these ICEs -as in #730406 let's backport it to gcc-10. - -https://gcc.gnu.org/PR95820 -https://bugs.gentoo.org/730406 a/gcc/cp/decl.c -+++ b/gcc/cp/decl.c -@@ -12029,14 +12029,11 @@ grokdeclarator (const cp_declarator *declarator, - - /* Handle a late-specified return type. */ - tree late_return_type = declarator->u.function.late_return_type; -- if (funcdecl_p -- /* This is the case e.g. for -- using T = auto () -> int. */ -- || inner_declarator == NULL) -+ if (true) - { - if (tree auto_node = type_uses_auto (type)) - { -- if (!late_return_type) -+ if (!late_return_type && funcdecl_p) - { - if (current_class_type - && LAMBDA_TYPE_P (current_class_type)) diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index 639805d..81678b5 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -1,3 +1,6 @@ +6 TODO + - 34_all_fundecl-ICE-PR95820.patch + 5 18 Dec 2020 + 41_all_strlen-PR96758.patch
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: e71e59c25315ebda3ebf4014bb108db9dda08a27 Author: Sergei Trofimovich gentoo org> AuthorDate: Fri Dec 18 20:57:44 2020 + Commit: Sergei Trofimovich gentoo org> CommitDate: Fri Dec 18 20:57:44 2020 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=e71e59c2 10.2.0: cut 5 patchset Single new patch: + 41_all_strlen-PR96758.patch: fix string comparison against literals Bug: https://bugs.gentoo.org/757792 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/README.history | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index 8b8c475..639805d 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -1,4 +1,4 @@ -5 TODO +5 18 Dec 2020 + 41_all_strlen-PR96758.patch 4 04 Nov 2020
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: 3779ee05e8c035d435c62198f3b761516e63fdf0 Author: Sergei Trofimovich gentoo org> AuthorDate: Tue Dec 29 10:05:50 2020 + Commit: Sergei Trofimovich gentoo org> CommitDate: Tue Dec 29 10:05:50 2020 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=3779ee05 10.2.0: cut 6 patchset Single dropped patch: - 34_all_fundecl-ICE-PR95820.patch: revert PR95820 backporting Bug: https://gcc.gnu.org/PR95820 Bug: https://bugs.gentoo.org/730406 Reported-by: Daniel Santos Bug: https://gcc.gnu.org/PR98441 Bug: https://bugs.gentoo.org/762382 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/README.history | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index 81678b5..48587e1 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -1,4 +1,4 @@ -6 TODO +6 29 Dec 2020 - 34_all_fundecl-ICE-PR95820.patch 5 18 Dec 2020
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: 9b342fdeb8588681bb106e072cefd481a045fb21 Author: Sergei Trofimovich gentoo org> AuthorDate: Tue Dec 1 19:16:33 2020 + Commit: Sergei Trofimovich gentoo org> CommitDate: Tue Dec 1 19:16:33 2020 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=9b342fde 10.2.0: backport strncmp() folding Reported-by: Matt Whitlock Bug: https://bugs.gentoo.org/757792 Bug: https://gcc.gnu.org/PR96758 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/41_all_strlen-PR96758.patch | 95 +++ 10.2.0/gentoo/README.history | 3 + 2 files changed, 98 insertions(+) diff --git a/10.2.0/gentoo/41_all_strlen-PR96758.patch b/10.2.0/gentoo/41_all_strlen-PR96758.patch new file mode 100644 index 000..fccf2de --- /dev/null +++ b/10.2.0/gentoo/41_all_strlen-PR96758.patch @@ -0,0 +1,95 @@ +https://bugs.gentoo.org/757792 + +From 0dbfa88edafbe913a7a9099246041e0190aa3948 Mon Sep 17 00:00:00 2001 +From: Jakub Jelinek +Date: Tue, 25 Aug 2020 13:47:10 +0200 +Subject: [PATCH] strlen: Fix handle_builtin_string_cmp [PR96758] + +The following testcase is miscompiled, because handle_builtin_string_cmp +sees a strncmp call with constant last argument 4, where one of the strings +has an upper bound of 5 bytes (due to it being an array of that size) and +the other has a known string length of 1 and the result is used only in +equality comparison. +It is folded into __builtin_strncmp_eq (str1, str2, 4), which is +incorrect, because that means reading 4 bytes from both strings and +comparing that. When one of the strings has known strlen of 1, we want to +compare just 2 bytes, not 4, as strncmp shouldn't compare any bytes beyond +the null. +So, the last argument to __builtin_strncmp_eq should be the minimum of the +provided strncmp last argument and the known string length + 1 (assuming +the other string has only a known upper bound due to array size). + +Besides that, I've noticed the code has been written with the intent to also +support the case where we know exact string length of both strings (but not +the string content, so we can't compute it at compile time). In that case, +both cstlen1 and cstlen2 are non-negative and both arysiz1 and arysiz2 are +negative. We wouldn't optimize that, cmpsiz would be either the strncmp +last argument, or for strcmp the first string length, but varsiz would be +-1 and thus cmpsiz would be never < varsiz. The patch fixes it by using the +correct length, in that case using the minimum of the two and for strncmp +also the last argument. + +2020-08-25 Jakub Jelinek + + PR tree-optimization/96758 + * tree-ssa-strlen.c (handle_builtin_string_cmp): If both cstlen1 + and cstlen2 are set, set cmpsiz to their minimum, otherwise use the + one that is set. If bound is used and smaller than cmpsiz, set cmpsiz + to bound. If both cstlen1 and cstlen2 are set, perform the optimization. + + * gcc.dg/strcmpopt_12.c: New test. + +(cherry picked from commit f982a6ec9b6d98f5f37114b1d7455c54ce5056b8) +--- + gcc/testsuite/gcc.dg/strcmpopt_12.c | 17 + + gcc/tree-ssa-strlen.c | 10 +- + 2 files changed, 26 insertions(+), 1 deletion(-) + create mode 100644 gcc/testsuite/gcc.dg/strcmpopt_12.c + +diff --git a/gcc/testsuite/gcc.dg/strcmpopt_12.c b/gcc/testsuite/gcc.dg/strcmpopt_12.c +new file mode 100644 +index 000..d8077b62f7f +--- /dev/null b/gcc/testsuite/gcc.dg/strcmpopt_12.c +@@ -0,0 +1,17 @@ ++/* PR tree-optimization/96758 */ ++/* { dg-do run } */ ++/* { dg-options "-O2" } */ ++ ++int v = 1; ++ ++int ++main () ++{ ++ const char *s = v ? "a" : "b"; ++ char x[5]; ++ char y[5] = "a\0a"; ++ __builtin_memcpy (x, y, sizeof (y)); ++ if (__builtin_strncmp (x, s, 4) != 0) ++__builtin_abort (); ++ return 0; ++} +diff --git a/gcc/tree-ssa-strlen.c b/gcc/tree-ssa-strlen.c +index 93d095e1896..b0874da5d1e 100644 +--- a/gcc/tree-ssa-strlen.c b/gcc/tree-ssa-strlen.c +@@ -4485,7 +4485,15 @@ handle_builtin_string_cmp (gimple_stmt_iterator *gsi, const vr_values *rvals) + ++cstlen2; + + /* The exact number of characters to compare. */ +- HOST_WIDE_INT cmpsiz = bound < 0 ? cstlen1 < 0 ? cstlen2 : cstlen1 : bound; ++ HOST_WIDE_INT cmpsiz; ++ if (cstlen1 >= 0 && cstlen2 >= 0) ++cmpsiz = MIN (cstlen1, cstlen2); ++ else if (cstlen1 >= 0) ++cmpsiz = cstlen1; ++ else ++cmpsiz = cstlen2; ++ if (bound >= 0) ++cmpsiz = MIN (cmpsiz, bound); + /* The size of the array in which the unknown string is stored. */ + HOST_WIDE_INT varsiz = arysiz1 < 0 ? arysiz2 : arysiz1; + +-- +2.29.2 + diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index e0207e7..8b8c475 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -1,3 +1,6 @@ +5 TODO + + 41_all_strlen-PR96758.patch + 4 04 Nov 2020 + 40_all_ipa-to_frequency.patch
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: 0d98cab225ecb321bc18d894951bb2d3b7b45bd0 Author: Sergei Trofimovich gentoo org> AuthorDate: Mon Aug 17 21:26:01 2020 + Commit: Sergei Trofimovich gentoo org> CommitDate: Mon Aug 17 21:26:01 2020 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=0d98cab2 10.2.0: backport ipa-cp bit fix, part 2 (PR/96482) Reported-by: Johannes Hirte Bug: https://bugs.gentoo.org/736685 Bug: https://gcc.gnu.org/PR96482 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/36_all_ipa-fix-bit-CP-p2.patch | 80 10.2.0/gentoo/README.history | 1 + 2 files changed, 81 insertions(+) diff --git a/10.2.0/gentoo/36_all_ipa-fix-bit-CP-p2.patch b/10.2.0/gentoo/36_all_ipa-fix-bit-CP-p2.patch new file mode 100644 index 000..1183b57 --- /dev/null +++ b/10.2.0/gentoo/36_all_ipa-fix-bit-CP-p2.patch @@ -0,0 +1,80 @@ +https://bugs.gentoo.org/736685 +https://gcc.gnu.org/PR96482 + +From 4a2371497e9bed64aa4f46169127f3ea8e32e726 Mon Sep 17 00:00:00 2001 +From: Martin Liska +Date: Thu, 13 Aug 2020 09:38:41 +0200 +Subject: [PATCH] ipa: fix ICE in get_default_value + +The patch aligns code with ipcp_bits_lattice::set_to_constant +where we properly mask m_value with m_mask. The same should +be done here. + +gcc/ChangeLog: + + PR ipa/96482 + * ipa-cp.c (ipcp_bits_lattice::meet_with_1): Mask m_value + with m_mask. + +gcc/testsuite/ChangeLog: + + PR ipa/96482 + * gcc.dg/ipa/pr96482-2.c: New test. + +(cherry picked from commit f91770216eade83f068528c1e4f00e2ac3b23044) +--- + gcc/ipa-cp.c | 2 +- + gcc/testsuite/gcc.dg/ipa/pr96482-2.c | 33 + 2 files changed, 34 insertions(+), 1 deletion(-) + create mode 100644 gcc/testsuite/gcc.dg/ipa/pr96482-2.c + +--- a/gcc/ipa-cp.c b/gcc/ipa-cp.c +@@ -1047,7 +1047,7 @@ ipcp_bits_lattice::meet_with_1 (widest_int value, widest_int mask, + + widest_int old_mask = m_mask; + m_mask = (m_mask | mask) | (m_value ^ value); +- m_value &= value; ++ m_value &= ~m_mask; + + if (wi::sext (m_mask, precision) == -1) + return set_to_bottom (); +--- /dev/null b/gcc/testsuite/gcc.dg/ipa/pr96482-2.c +@@ -0,0 +1,33 @@ ++/* PR ipa/96482 */ ++/* { dg-do compile } */ ++/* { dg-options "-O2" } */ ++ ++int i2c_transfer(); ++void _dev_err(); ++ ++struct i2c_msg { ++ char bufaddr; ++ int adapterdev; ++} wdt87xx_i2c_xfer_client; ++ ++int wdt87xx_i2c_xfer_client_0, wdt87xx_i2c_xfer_rxdata, wdt87xx_get_string_str_idx; ++ ++void ++static wdt87xx_i2c_xfer(void *txdata, unsigned rxlen) { ++ struct i2c_msg msgs[] = {wdt87xx_i2c_xfer_client_0, rxlen, ++ wdt87xx_i2c_xfer_rxdata}; ++ int error = i2c_transfer(wdt87xx_i2c_xfer_client, msgs); ++ _dev_err("", __func__, error); ++} ++static void wdt87xx_get_string(unsigned len) { ++ char tx_buf[] = {wdt87xx_get_string_str_idx, 3}; ++ int rx_len = len + 2; ++ wdt87xx_i2c_xfer(tx_buf, rx_len); ++} ++ ++void ++wdt87xx_ts_probe_tx_buf() { ++ wdt87xx_get_string(34); ++ wdt87xx_get_string(8); ++ wdt87xx_i2c_xfer(wdt87xx_ts_probe_tx_buf, 2); ++} +-- +2.28.0 + diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index 49edda3..8be215b 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -2,6 +2,7 @@ + 33_all_lto-O0-mix-ICE-ipa-PR96291.patch + 34_all_fundecl-ICE-PR95820.patch + 35_all_ipa-fix-bit-CP.patch + + 36_all_ipa-fix-bit-CP-p2.patch 1 23 July 2020 + 01_all_default-fortify-source.patch
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: 9bba1f72a9210743fddf664b716b5cf288132922 Author: Sergei Trofimovich gentoo org> AuthorDate: Sun Aug 23 09:11:31 2020 + Commit: Sergei Trofimovich gentoo org> CommitDate: Sun Aug 23 09:11:31 2020 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=9bba1f72 10.2.0: cut 2 patchset Four new patches: + 33_all_lto-O0-mix-ICE-ipa-PR96291.patch: fix -O0 crash for ipa/lto + 34_all_fundecl-ICE-PR95820.patch: fix ICE on invalid templates + 35_all_ipa-fix-bit-CP.patch: fix bad code generation in ipa bit constprop + 36_all_ipa-fix-bit-CP-p2.patch: part 2 of previous patch Bug: https://bugs.gentoo.org/733482 Bug: https://gcc.gnu.org/PR96291 Bug: https://bugs.gentoo.org/730406 Bug: https://gcc.gnu.org/PR95820 Bug: https://bugs.gentoo.org/736685 Bug: https://gcc.gnu.org/PR96482 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/README.history | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index 8be215b..1bfe565 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -1,4 +1,4 @@ -2 TODO +2 23 Aug 2020 + 33_all_lto-O0-mix-ICE-ipa-PR96291.patch + 34_all_fundecl-ICE-PR95820.patch + 35_all_ipa-fix-bit-CP.patch
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: 064908a8c0b537e980721c7996d276e1901924db Author: Sergei Trofimovich gentoo org> AuthorDate: Thu Jul 23 08:15:06 2020 + Commit: Sergei Trofimovich gentoo org> CommitDate: Thu Jul 23 08:15:06 2020 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=064908a8 10.2.0: cut 1 patchset Based on gcc-10.1.0 patchset. The only change is upstreamed backportes: - 29_all_fix-float-hang-PR95118.patch - 31_all_ctor-range-PR95241.patch - 33_all_avx512-scalar-PR95528.patch - 34_all_cet-cross-x86.patch - 35_all_ICE-array-subscript-PR95508.patch - 38_all_ICE-ipa-fnsummary-PR96130.patch Bug: https://gcc.gnu.org/PR96190 Bug: https://bugs.gentoo.org/619706 Bug: https://gcc.gnu.org/PR96130 Bug: https://bugs.gentoo.org/733246 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/01_all_default-fortify-source.patch | 22 .../02_all_default-warn-format-security.patch | 22 .../gentoo/03_all_default-warn-trampolines.patch | 13 ++ 10.2.0/gentoo/04_all_nossp-on-nostdlib.patch | 27 10.2.0/gentoo/05_all_alpha-mieee-default.patch | 39 ++ 10.2.0/gentoo/06_all_ia64_note.GNU-stack.patch | 92 + .../gentoo/07_all_i386_libgcc_note.GNU-stack.patch | 54 10.2.0/gentoo/08_all_libiberty-asprintf.patch | 18 +++ 10.2.0/gentoo/09_all_libiberty-pic.patch | 10 ++ 10.2.0/gentoo/10_all_nopie-all-flags.patch | 18 +++ 10.2.0/gentoo/11_all_sh-drop-sysroot-suffix.patch | 32 + 10.2.0/gentoo/12_all_ia64-TEXTREL.patch| 22 .../gentoo/13_all_disable-systemtap-switch.patch | 122 ++ 10.2.0/gentoo/14_all_m68k-textrel-on-libgcc.patch | 93 ++ 10.2.0/gentoo/15_all_respect-build-cxxflags.patch | 39 ++ 10.2.0/gentoo/16_all_libgfortran-Werror.patch | 20 +++ 10.2.0/gentoo/17_all_libgomp-Werror.patch | 20 +++ 10.2.0/gentoo/18_all_libitm-Werror.patch | 19 +++ 10.2.0/gentoo/19_all_libatomic-Werror.patch| 19 +++ 10.2.0/gentoo/20_all_libbacktrace-Werror.patch | 17 +++ 10.2.0/gentoo/21_all_libsanitizer-Werror.patch | 17 +++ 10.2.0/gentoo/22_all_libstdcxx-no-vtv.patch| 61 + 10.2.0/gentoo/23_all_disable-riscv32-ABIs.patch| 53 10.2.0/gentoo/24_all_default_ssp-buffer-size.patch | 14 ++ 10.2.0/gentoo/25_all_hppa-faster-synth_mult.patch | 44 +++ 10.2.0/gentoo/26_all_libcpp-ar.patch | 143 + 10.2.0/gentoo/27_all_EXTRA_OPTIONS-z-now.patch | 26 ...all_EXTRA_OPTIONS-fstack-clash-protection.patch | 65 ++ .../29_all_lto-intl-workaround-PR95194.patch | 20 +++ 10.2.0/gentoo/30_all_plugin-objdump.patch | 34 + 10.2.0/gentoo/31_all_fno-delayed-branch.patch | 40 ++ 10.2.0/gentoo/32_all_sparc_pie_TEXTREL.patch | 49 +++ 10.2.0/gentoo/README.history | 33 + 33 files changed, 1317 insertions(+) diff --git a/10.2.0/gentoo/01_all_default-fortify-source.patch b/10.2.0/gentoo/01_all_default-fortify-source.patch new file mode 100644 index 000..d307474 --- /dev/null +++ b/10.2.0/gentoo/01_all_default-fortify-source.patch @@ -0,0 +1,22 @@ +Taken Debian's patch and removed docs matches: +https://salsa.debian.org/toolchain-team/gcc.git +Also see https://bugs.gentoo.org/621036 where +initially Gentoo used too complicated macro. + +# DP: Turn on -D_FORTIFY_SOURCE=2 by default for C, C++, ObjC, ObjC++, +# DP: if the optimization level is > 0 +--- a/gcc/c-family/c-cppbuiltin.c b/gcc/c-family/c-cppbuiltin.c +@@ -951,6 +951,12 @@ c_cpp_builtins (cpp_reader *pfile) + builtin_define_with_value ("__REGISTER_PREFIX__", REGISTER_PREFIX, 0); + builtin_define_with_value ("__USER_LABEL_PREFIX__", user_label_prefix, 0); + ++#if !defined(ACCEL_COMPILER) ++ /* Fortify Source enabled by default for optimization levels > 0 */ ++ if (optimize) ++builtin_define_with_int_value ("_FORTIFY_SOURCE", 2); ++#endif ++ + /* Misc. */ + if (flag_gnu89_inline) + cpp_define (pfile, "__GNUC_GNU_INLINE__"); diff --git a/10.2.0/gentoo/02_all_default-warn-format-security.patch b/10.2.0/gentoo/02_all_default-warn-format-security.patch new file mode 100644 index 000..f809abd --- /dev/null +++ b/10.2.0/gentoo/02_all_default-warn-format-security.patch @@ -0,0 +1,22 @@ +Enable -Wformat and -Wformat-security by default. + +--- a/gcc/c-family/c.opt 2016-03-23 18:51:56.0 +0100 b/gcc/c-family/c.opt 2016-04-28 23:45:54.063351272 +0200 +@@ -459,7 +459,7 @@ C ObjC C++ ObjC++ Var(warn_format_nonlit + Warn about format strings that are not literals. + + Wformat-security +-C ObjC C++ ObjC++ Var(warn_format_security) Warning LangEnabledBy(C ObjC C++ ObjC++,Wformat=, warn_format >= 2, 0) ++C ObjC C++ ObjC++ Var(warn_format_security) Init(1) Warning LangEnabledBy(C ObjC C++ ObjC++,Wformat=, warn_format >= 2, 0) + Warn about possible security problems
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: 8f9b6cda0cd772b5155d52a5effabd04fd656a18 Author: Sergei Trofimovich gentoo org> AuthorDate: Sun Jul 26 10:34:45 2020 + Commit: Sergei Trofimovich gentoo org> CommitDate: Sun Jul 26 10:34:45 2020 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=8f9b6cda 10.2.0: fix IPA ICE on LTO -O0/-O2 mix Bug: https://bugs.gentoo.org/733482 Bug: https://gcc.gnu.org/PR96291 Signed-off-by: Sergei Trofimovich gentoo.org> .../gentoo/33_all_lto-O0-mix-ICE-ipa-PR96291.patch | 46 ++ 10.2.0/gentoo/README.history | 3 ++ 2 files changed, 49 insertions(+) diff --git a/10.2.0/gentoo/33_all_lto-O0-mix-ICE-ipa-PR96291.patch b/10.2.0/gentoo/33_all_lto-O0-mix-ICE-ipa-PR96291.patch new file mode 100644 index 000..b163721 --- /dev/null +++ b/10.2.0/gentoo/33_all_lto-O0-mix-ICE-ipa-PR96291.patch @@ -0,0 +1,46 @@ +https://bugs.gentoo.org/733482 +https://gcc.gnu.org/PR96291 + +From 03810b1b2dec00575b2bcb579eb3d7c34bd176bc Mon Sep 17 00:00:00 2001 +From: Sergei Trofimovich +Date: Sat, 25 Jul 2020 19:26:50 +0100 +Subject: [PATCH] ipa/96291: don't crash on unoptimized lto functions + +In PR ipa/96291 the test contained an SCC with one +unoptimized function. This tricked ipa-cp into NULL dereference. + +has_undead_caller_from_outside_scc_p() did not take into account +that unoptimized funtions don't have IPA summary analysis. and +dereferenced NULL pointer causing an ICE. + + PR ipa/96291 + * ipa-cp.c (has_undead_caller_from_outside_scc_p): Consider + unoptimized callers as undead. +--- + gcc/ipa-cp.c | 12 +--- + 1 file changed, 9 insertions(+), 3 deletions(-) + +--- a/gcc/ipa-cp.c b/gcc/ipa-cp.c +@@ -5666,9 +5666,15 @@ has_undead_caller_from_outside_scc_p (struct cgraph_node *node, + && cs->caller->call_for_symbol_thunks_and_aliases + (has_undead_caller_from_outside_scc_p, NULL, true)) + return true; +-else if (!ipa_edge_within_scc (cs) +- && !IPA_NODE_REF (cs->caller)->node_dead) +- return true; ++else if (!ipa_edge_within_scc (cs)) ++ { ++ /* Unoptimized callers don't have IPA information. ++ Conservatively assume callers are undead. */ ++ if (!IPA_NODE_REF (cs->caller)) ++return true; ++ if (!IPA_NODE_REF (cs->caller)->node_dead) ++return true; ++ } + return false; + } + +-- +2.27.0 + diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index 4009f39..1c0fff9 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -1,3 +1,6 @@ +2 TODO + + 33_all_lto-O0-mix-ICE-ipa-PR96291.patch + 1 23 July 2020 + 01_all_default-fortify-source.patch + 02_all_default-warn-format-security.patch
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: fafbb4148cb5c2cf7e1ae02679240cba43e95992 Author: Sergei Trofimovich gentoo org> AuthorDate: Mon Jul 27 06:48:54 2020 + Commit: Sergei Trofimovich gentoo org> CommitDate: Mon Jul 27 06:48:54 2020 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=fafbb414 10.2.0: backport ICE on invalid function declarations Reported-by: Jack Ostroff Bug: https://bugs.gentoo.org/730406 Bug: https://gcc.gnu.org/PR95820 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/34_all_fundecl-ICE-PR95820.patch | 25 + 10.2.0/gentoo/README.history | 1 + 2 files changed, 26 insertions(+) diff --git a/10.2.0/gentoo/34_all_fundecl-ICE-PR95820.patch b/10.2.0/gentoo/34_all_fundecl-ICE-PR95820.patch new file mode 100644 index 000..e365420 --- /dev/null +++ b/10.2.0/gentoo/34_all_fundecl-ICE-PR95820.patch @@ -0,0 +1,25 @@ +It's an unofficial backport of PR95820 where gcc ICEs on +invalid syntax. As creduce frequently end up in these ICEs +as in #730406 let's backport it to gcc-10. + +https://gcc.gnu.org/PR95820 +https://bugs.gentoo.org/730406 +--- a/gcc/cp/decl.c b/gcc/cp/decl.c +@@ -12029,14 +12029,11 @@ grokdeclarator (const cp_declarator *declarator, + + /* Handle a late-specified return type. */ + tree late_return_type = declarator->u.function.late_return_type; +- if (funcdecl_p +- /* This is the case e.g. for +- using T = auto () -> int. */ +- || inner_declarator == NULL) ++ if (true) + { + if (tree auto_node = type_uses_auto (type)) + { +- if (!late_return_type) ++ if (!late_return_type && funcdecl_p) + { + if (current_class_type + && LAMBDA_TYPE_P (current_class_type)) diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index 1c0fff9..7cde6a3 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -1,5 +1,6 @@ 2 TODO + 33_all_lto-O0-mix-ICE-ipa-PR96291.patch + + 34_all_fundecl-ICE-PR95820.patch 1 23 July 2020 + 01_all_default-fortify-source.patch
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: d6e1bf3168cce755396a408032b4804a7a527d43 Author: Sergei Trofimovich gentoo org> AuthorDate: Wed Nov 4 00:03:31 2020 + Commit: Sergei Trofimovich gentoo org> CommitDate: Wed Nov 4 07:26:02 2020 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=d6e1bf31 10.2.0: cut 4 patchset Single new patch: + 40_all_ipa-to_frequency.patch: fix ICE on empty profile merges. Bug: https://bugs.gentoo.org/746578 Bug: https://gcc.gnu.org/PR97295 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/README.history | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index e419e62..e0207e7 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -1,4 +1,4 @@ -4 TODO +4 04 Nov 2020 + 40_all_ipa-to_frequency.patch 3 02 Oct 2020
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: 50322c7c5fb8f869f45f8dd23a89f4a7c4b8ba2d Author: Sergei Trofimovich gentoo org> AuthorDate: Thu Apr 8 19:36:03 2021 + Commit: Sergei Trofimovich gentoo org> CommitDate: Thu Apr 8 19:36:03 2021 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=50322c7c 10.2.0: revert "port binutils fix for CET detection on i486" The patch is not ready for prime time. Le't pull newer upstream version a bit later. This reverts commit 5600e4343f36e2a4925b09388d3ffe7400143b9f. Reported-by: Worx Bug: https://bugs.gentoo.org/777117 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/44_all_cet-i486.patch | 109 10.2.0/gentoo/README.history| 1 - 2 files changed, 110 deletions(-) diff --git a/10.2.0/gentoo/44_all_cet-i486.patch b/10.2.0/gentoo/44_all_cet-i486.patch deleted file mode 100644 index 956e439..000 --- a/10.2.0/gentoo/44_all_cet-i486.patch +++ /dev/null @@ -1,109 +0,0 @@ -https://bugs.gentoo.org/777117 - -From 267a609477624ade477994b24809a72eeb522ff1 Mon Sep 17 00:00:00 2001 -From: "H.J. Lu via Gcc-patches" -Date: Sun, 14 Feb 2021 09:26:40 -0800 -Subject: [PATCH 2/2] GCC_CET_HOST_FLAGS: Check if host supports multi-byte - NOPs - -Check if host supports multi-byte NOPs before enabling CET on host. - -config/ - - PR binutils/27397 - * cet.m4 (GCC_CET_HOST_FLAGS): Check if host supports multi-byte - NOPs. - -libiberty/ - - PR binutils/27397 - * configure: Regenerated. - - config/cet.m4 | 19 --- - libiberty/configure | 29 + - 2 files changed, 45 insertions(+), 3 deletions(-) - a/config/cet.m4 -+++ b/config/cet.m4 -@@ -130,6 +130,18 @@ fi - if test x$may_have_cet = xyes; then - if test x$cross_compiling = xno; then - AC_TRY_RUN([ -+int -+main () -+{ -+ asm ("endbr32"); -+ return 0; -+} -+], -+[have_multi_byte_nop=yes], -+[have_multi_byte_nop=no]) -+have_cet=no -+if test x$have_multi_byte_nop = xyes; then -+ AC_TRY_RUN([ - static void - foo (void) - { -@@ -155,9 +167,10 @@ main () - bar (); - return 0; - } --], --[have_cet=no], --[have_cet=yes]) -+ ], -+ [have_cet=no], -+ [have_cet=yes]) -+fi - if test x$enable_cet = xno -a x$have_cet = xyes; then - AC_MSG_ERROR([Intel CET must be enabled on Intel CET enabled host]) - fi a/libiberty/configure -+++ b/libiberty/configure -@@ -5396,6 +5396,34 @@ else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext - /* end confdefs.h. */ - -+int -+main () -+{ -+ asm ("endbr32"); -+ return 0; -+} -+ -+_ACEOF -+if ac_fn_c_try_run "$LINENO"; then : -+ have_multi_byte_nop=yes -+else -+ have_multi_byte_nop=no -+fi -+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ -+ conftest.$ac_objext conftest.beam conftest.$ac_ext -+fi -+ -+have_cet=no -+if test x$have_multi_byte_nop = xyes; then -+ if test "$cross_compiling" = yes; then : -+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -+as_fn_error $? "cannot run test program while cross compiling -+See \`config.log' for more details" "$LINENO" 5; } -+else -+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext -+/* end confdefs.h. */ -+ - static void - foo (void) - { -@@ -5432,6 +5460,7 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext - fi - -+fi - if test x$enable_cet = xno -a x$have_cet = xyes; then - as_fn_error $? "Intel CET must be enabled on Intel CET enabled host" "$LINENO" 5 - fi --- -2.31.0 - diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index f47a108..f195ae9 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -1,7 +1,6 @@ 7 TODO + 42_all_vmat-PR97236.patch + 43_all_vtv-slibtool.patch - + 44_all_cet-i486.patch 6 29 Dec 2020 - 34_all_fundecl-ICE-PR95820.patch
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: 5600e4343f36e2a4925b09388d3ffe7400143b9f Author: Sergei Trofimovich gentoo org> AuthorDate: Fri Mar 19 08:01:22 2021 + Commit: Sergei Trofimovich gentoo org> CommitDate: Fri Mar 19 08:01:22 2021 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=5600e434 10.2.0: port binutils fix for CET detection on i486 Reported-by: Worx Bug: https://bugs.gentoo.org/777117 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/44_all_cet-i486.patch | 109 10.2.0/gentoo/README.history| 1 + 2 files changed, 110 insertions(+) diff --git a/10.2.0/gentoo/44_all_cet-i486.patch b/10.2.0/gentoo/44_all_cet-i486.patch new file mode 100644 index 000..956e439 --- /dev/null +++ b/10.2.0/gentoo/44_all_cet-i486.patch @@ -0,0 +1,109 @@ +https://bugs.gentoo.org/777117 + +From 267a609477624ade477994b24809a72eeb522ff1 Mon Sep 17 00:00:00 2001 +From: "H.J. Lu via Gcc-patches" +Date: Sun, 14 Feb 2021 09:26:40 -0800 +Subject: [PATCH 2/2] GCC_CET_HOST_FLAGS: Check if host supports multi-byte + NOPs + +Check if host supports multi-byte NOPs before enabling CET on host. + +config/ + + PR binutils/27397 + * cet.m4 (GCC_CET_HOST_FLAGS): Check if host supports multi-byte + NOPs. + +libiberty/ + + PR binutils/27397 + * configure: Regenerated. + +--- + config/cet.m4 | 19 --- + libiberty/configure | 29 + + 2 files changed, 45 insertions(+), 3 deletions(-) + +--- a/config/cet.m4 b/config/cet.m4 +@@ -130,6 +130,18 @@ fi + if test x$may_have_cet = xyes; then + if test x$cross_compiling = xno; then + AC_TRY_RUN([ ++int ++main () ++{ ++ asm ("endbr32"); ++ return 0; ++} ++], ++[have_multi_byte_nop=yes], ++[have_multi_byte_nop=no]) ++have_cet=no ++if test x$have_multi_byte_nop = xyes; then ++ AC_TRY_RUN([ + static void + foo (void) + { +@@ -155,9 +167,10 @@ main () + bar (); + return 0; + } +-], +-[have_cet=no], +-[have_cet=yes]) ++ ], ++ [have_cet=no], ++ [have_cet=yes]) ++fi + if test x$enable_cet = xno -a x$have_cet = xyes; then + AC_MSG_ERROR([Intel CET must be enabled on Intel CET enabled host]) + fi +--- a/libiberty/configure b/libiberty/configure +@@ -5396,6 +5396,34 @@ else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ + ++int ++main () ++{ ++ asm ("endbr32"); ++ return 0; ++} ++ ++_ACEOF ++if ac_fn_c_try_run "$LINENO"; then : ++ have_multi_byte_nop=yes ++else ++ have_multi_byte_nop=no ++fi ++rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ ++ conftest.$ac_objext conftest.beam conftest.$ac_ext ++fi ++ ++have_cet=no ++if test x$have_multi_byte_nop = xyes; then ++ if test "$cross_compiling" = yes; then : ++ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 ++$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} ++as_fn_error $? "cannot run test program while cross compiling ++See \`config.log' for more details" "$LINENO" 5; } ++else ++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext ++/* end confdefs.h. */ ++ + static void + foo (void) + { +@@ -5432,6 +5460,7 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext + fi + ++fi + if test x$enable_cet = xno -a x$have_cet = xyes; then + as_fn_error $? "Intel CET must be enabled on Intel CET enabled host" "$LINENO" 5 + fi +-- +2.31.0 + diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index f195ae9..f47a108 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -1,6 +1,7 @@ 7 TODO + 42_all_vmat-PR97236.patch + 43_all_vtv-slibtool.patch + + 44_all_cet-i486.patch 6 29 Dec 2020 - 34_all_fundecl-ICE-PR95820.patch
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: 8634da04f3f6214cc36ebfeba38c4f3fca4473be Author: Sergei Trofimovich gentoo org> AuthorDate: Thu Mar 4 10:59:30 2021 + Commit: Sergei Trofimovich gentoo org> CommitDate: Thu Mar 4 10:59:30 2021 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=8634da04 10.2.0: backport PR97236: fix bad use of VMAT_CONTIGUOUS Bug: https://gcc.gnu.org/PR97236 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/42_all_vmat-PR97236.patch | 116 10.2.0/gentoo/README.history| 3 + 2 files changed, 119 insertions(+) diff --git a/10.2.0/gentoo/42_all_vmat-PR97236.patch b/10.2.0/gentoo/42_all_vmat-PR97236.patch new file mode 100644 index 000..5a7643c --- /dev/null +++ b/10.2.0/gentoo/42_all_vmat-PR97236.patch @@ -0,0 +1,116 @@ +https://gcc.gnu.org/PR97236 + +From 1ab88985631dd2c5a5e3b5c0dce47cf8b6ed2f82 Mon Sep 17 00:00:00 2001 +From: Matthias Klose +Date: Tue, 6 Oct 2020 13:41:37 +0200 +Subject: [PATCH] Backport fix for PR/tree-optimization/97236 - fix bad use of + VMAT_CONTIGUOUS + +This avoids using VMAT_CONTIGUOUS with single-element interleaving +when using V1mode vectors. Instead keep VMAT_ELEMENTWISE but +continue to avoid load-lanes and gathers. + +2020-10-01 Richard Biener + + PR tree-optimization/97236 + * tree-vect-stmts.c (get_group_load_store_type): Keep + VMAT_ELEMENTWISE for single-element vectors. + + * gcc.dg/vect/pr97236.c: New testcase. +--- + gcc/testsuite/gcc.dg/vect/pr97236.c | 43 + + gcc/tree-vect-stmts.c | 20 ++ + 2 files changed, 52 insertions(+), 11 deletions(-) + create mode 100644 gcc/testsuite/gcc.dg/vect/pr97236.c + +diff --git a/gcc/testsuite/gcc.dg/vect/pr97236.c b/gcc/testsuite/gcc.dg/vect/pr97236.c +new file mode 100644 +index 000..9d3dc20d953 +--- /dev/null b/gcc/testsuite/gcc.dg/vect/pr97236.c +@@ -0,0 +1,43 @@ ++typedef unsigned char __uint8_t; ++typedef __uint8_t uint8_t; ++typedef struct plane_t { ++ uint8_t *p_pixels; ++ int i_lines; ++ int i_pitch; ++} plane_t; ++ ++typedef struct { ++ plane_t p[5]; ++} picture_t; ++ ++#define N 4 ++ ++void __attribute__((noipa)) ++picture_Clone(picture_t *picture, picture_t *res) ++{ ++ for (int i = 0; i < N; i++) { ++res->p[i].p_pixels = picture->p[i].p_pixels; ++res->p[i].i_lines = picture->p[i].i_lines; ++res->p[i].i_pitch = picture->p[i].i_pitch; ++ } ++} ++ ++int ++main() ++{ ++ picture_t aaa, bbb; ++ uint8_t pixels[10] = {1, 1, 1, 1, 1, 1, 1, 1}; ++ ++ for (unsigned i = 0; i < N; i++) ++aaa.p[i].p_pixels = pixels; ++ ++ picture_Clone (&aaa, &bbb); ++ ++ uint8_t c = 0; ++ for (unsigned i = 0; i < N; i++) ++c += bbb.p[i].p_pixels[0]; ++ ++ if (c != N) ++__builtin_abort (); ++ return 0; ++} +diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c +index 9ace345fc5e..d8b2ff3d6ee 100644 +--- a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c +@@ -2413,25 +2413,23 @@ get_group_load_store_type (stmt_vec_info stmt_info, tree vectype, bool slp, + /* First cope with the degenerate case of a single-element +vector. */ + if (known_eq (TYPE_VECTOR_SUBPARTS (vectype), 1U)) +- *memory_access_type = VMAT_CONTIGUOUS; ++ ; + + /* Otherwise try using LOAD/STORE_LANES. */ +-if (*memory_access_type == VMAT_ELEMENTWISE +-&& (vls_type == VLS_LOAD +-? vect_load_lanes_supported (vectype, group_size, masked_p) +-: vect_store_lanes_supported (vectype, group_size, +- masked_p))) ++else if (vls_type == VLS_LOAD ++ ? vect_load_lanes_supported (vectype, group_size, masked_p) ++ : vect_store_lanes_supported (vectype, group_size, ++ masked_p)) + { + *memory_access_type = VMAT_LOAD_STORE_LANES; + overrun_p = would_overrun_p; + } + + /* If that fails, try using permuting loads. */ +-if (*memory_access_type == VMAT_ELEMENTWISE +-&& (vls_type == VLS_LOAD +-? vect_grouped_load_supported (vectype, single_element_p, +- group_size) +-: vect_grouped_store_supported (vectype, group_size))) ++else if (vls_type == VLS_LOAD ++ ? vect_grouped_load_supported (vectype, single_element_p, ++group_size) ++ : vect_grouped_store_supported (vectype, group_size)) + { + *memory_access_type = VMAT_CONTIGUOUS_PERMUTE; + overrun_p = would_overrun_p; +-- +2.30.1 + diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index 48587e1..4ca261a 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -1,3 +1,6 @
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: bb31009f6bb62d2dbee6a4be9605c9286ef0df23 Author: Sergei Trofimovich gentoo org> AuthorDate: Thu Oct 15 17:30:51 2020 + Commit: Sergei Trofimovich gentoo org> CommitDate: Thu Oct 15 17:30:51 2020 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=bb31009f 10.2.0: backport IPA to_frequency() ICE Reported-by: inasprecali disroot.org Bug: https://bugs.gentoo.org/746578 Bug: https://gcc.gnu.org/PR97295 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/40_all_ipa-to_frequency.patch | 48 + 10.2.0/gentoo/README.history| 3 ++ 2 files changed, 51 insertions(+) diff --git a/10.2.0/gentoo/40_all_ipa-to_frequency.patch b/10.2.0/gentoo/40_all_ipa-to_frequency.patch new file mode 100644 index 000..0849207 --- /dev/null +++ b/10.2.0/gentoo/40_all_ipa-to_frequency.patch @@ -0,0 +1,48 @@ +https://bugs.gentoo.org/746578 +https://gcc.gnu.org/PR97295 + +From 508e2d88a4c512e8b8685cf5ba201ad48e6bb58d Mon Sep 17 00:00:00 2001 +From: Martin Liska +Date: Tue, 13 Oct 2020 16:44:47 +0200 +Subject: [PATCH] IPA: fix profile handling in IRA + +gcc/ChangeLog: + + PR ipa/97295 + * profile-count.c (profile_count::to_frequency): Move part of + gcc_assert to STATIC_ASSERT. + * regs.h (REG_FREQ_FROM_BB): Do not use count.to_frequency for + a function that does not have count_max initialized. +--- + gcc/profile-count.c | 4 ++-- + gcc/regs.h | 3 ++- + 2 files changed, 4 insertions(+), 3 deletions(-) + +--- a/gcc/profile-count.c b/gcc/profile-count.c +@@ -270,8 +270,8 @@ profile_count::to_frequency (struct function *fun) const + return BB_FREQ_MAX; + if (*this == zero ()) + return 0; +- gcc_assert (REG_BR_PROB_BASE == BB_FREQ_MAX +-&& fun->cfg->count_max.initialized_p ()); ++ STATIC_ASSERT (REG_BR_PROB_BASE == BB_FREQ_MAX); ++ gcc_assert (fun->cfg->count_max.initialized_p ()); + profile_probability prob = probability_in (fun->cfg->count_max); + if (!prob.initialized_p ()) + return REG_BR_PROB_BASE; +--- a/gcc/regs.h b/gcc/regs.h +@@ -128,7 +128,8 @@ extern size_t reg_info_p_size; +or profile driven feedback is available and the function is never executed, +frequency is always equivalent. Otherwise rescale the basic block +frequency. */ +-#define REG_FREQ_FROM_BB(bb) (optimize_function_for_size_p (cfun) \ ++#define REG_FREQ_FROM_BB(bb) ((optimize_function_for_size_p (cfun) \ ++ || !cfun->cfg->count_max.initialized_p ()) \ + ? REG_FREQ_MAX \ + : ((bb)->count.to_frequency (cfun) \ + * REG_FREQ_MAX / BB_FREQ_MAX) \ +-- +2.28.0 + diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index 86f3aae..e419e62 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -1,3 +1,6 @@ +4 TODO + + 40_all_ipa-to_frequency.patch + 3 02 Oct 2020 U 28_all_EXTRA_OPTIONS-fstack-clash-protection.patch + 37_all_c-vector-init-PR96377.patch
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: 7adab39a82fd07085f600603bdc5c440aa1c142a Author: Sergei Trofimovich gentoo org> AuthorDate: Tue Dec 29 09:51:52 2020 + Commit: Sergei Trofimovich gentoo org> CommitDate: Tue Dec 29 09:51:52 2020 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=7adab39a 10.2.0: revert PR95820 backporting The backport breaks parsing as seen in https://gcc.gnu.org/PR98441 Bug: https://gcc.gnu.org/PR95820 Bug: https://bugs.gentoo.org/730406 Reported-by: Daniel Santos Bug: https://gcc.gnu.org/PR98441 Bug: https://bugs.gentoo.org/762382 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/34_all_fundecl-ICE-PR95820.patch | 25 - 10.2.0/gentoo/README.history | 3 +++ 2 files changed, 3 insertions(+), 25 deletions(-) diff --git a/10.2.0/gentoo/34_all_fundecl-ICE-PR95820.patch b/10.2.0/gentoo/34_all_fundecl-ICE-PR95820.patch deleted file mode 100644 index e365420..000 --- a/10.2.0/gentoo/34_all_fundecl-ICE-PR95820.patch +++ /dev/null @@ -1,25 +0,0 @@ -It's an unofficial backport of PR95820 where gcc ICEs on -invalid syntax. As creduce frequently end up in these ICEs -as in #730406 let's backport it to gcc-10. - -https://gcc.gnu.org/PR95820 -https://bugs.gentoo.org/730406 a/gcc/cp/decl.c -+++ b/gcc/cp/decl.c -@@ -12029,14 +12029,11 @@ grokdeclarator (const cp_declarator *declarator, - - /* Handle a late-specified return type. */ - tree late_return_type = declarator->u.function.late_return_type; -- if (funcdecl_p -- /* This is the case e.g. for -- using T = auto () -> int. */ -- || inner_declarator == NULL) -+ if (true) - { - if (tree auto_node = type_uses_auto (type)) - { -- if (!late_return_type) -+ if (!late_return_type && funcdecl_p) - { - if (current_class_type - && LAMBDA_TYPE_P (current_class_type)) diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index 639805d..81678b5 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -1,3 +1,6 @@ +6 TODO + - 34_all_fundecl-ICE-PR95820.patch + 5 18 Dec 2020 + 41_all_strlen-PR96758.patch
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: e71e59c25315ebda3ebf4014bb108db9dda08a27 Author: Sergei Trofimovich gentoo org> AuthorDate: Fri Dec 18 20:57:44 2020 + Commit: Sergei Trofimovich gentoo org> CommitDate: Fri Dec 18 20:57:44 2020 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=e71e59c2 10.2.0: cut 5 patchset Single new patch: + 41_all_strlen-PR96758.patch: fix string comparison against literals Bug: https://bugs.gentoo.org/757792 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/README.history | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index 8b8c475..639805d 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -1,4 +1,4 @@ -5 TODO +5 18 Dec 2020 + 41_all_strlen-PR96758.patch 4 04 Nov 2020
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: 3779ee05e8c035d435c62198f3b761516e63fdf0 Author: Sergei Trofimovich gentoo org> AuthorDate: Tue Dec 29 10:05:50 2020 + Commit: Sergei Trofimovich gentoo org> CommitDate: Tue Dec 29 10:05:50 2020 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=3779ee05 10.2.0: cut 6 patchset Single dropped patch: - 34_all_fundecl-ICE-PR95820.patch: revert PR95820 backporting Bug: https://gcc.gnu.org/PR95820 Bug: https://bugs.gentoo.org/730406 Reported-by: Daniel Santos Bug: https://gcc.gnu.org/PR98441 Bug: https://bugs.gentoo.org/762382 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/README.history | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index 81678b5..48587e1 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -1,4 +1,4 @@ -6 TODO +6 29 Dec 2020 - 34_all_fundecl-ICE-PR95820.patch 5 18 Dec 2020
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: 7bf989ed8b53a13de6a6551b7f346b1dcadf5966 Author: Sergei Trofimovich gentoo org> AuthorDate: Fri Oct 2 09:12:10 2020 + Commit: Sergei Trofimovich gentoo org> CommitDate: Fri Oct 2 09:12:10 2020 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=7bf989ed 10.2.0: fix multiple speculation resolution on prog builds Reported-by: Ștefan Talpalaru Bug: https://gcc.gnu.org/PR96394 Bug: https://bugs.gentoo.org/734006 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/39_all_ipa-prop-multispec.patch | 150 ++ 10.2.0/gentoo/README.history | 1 + 2 files changed, 151 insertions(+) diff --git a/10.2.0/gentoo/39_all_ipa-prop-multispec.patch b/10.2.0/gentoo/39_all_ipa-prop-multispec.patch new file mode 100644 index 000..6e19992 --- /dev/null +++ b/10.2.0/gentoo/39_all_ipa-prop-multispec.patch @@ -0,0 +1,150 @@ +https://gcc.gnu.org/PR96394 +https://bugs.gentoo.org/734006 + +From 7f790f414ec38581b9bb033ab64e4ad12b9f8a4c Mon Sep 17 00:00:00 2001 +From: Martin Jambor +Date: Thu, 1 Oct 2020 19:39:27 +0200 +Subject: [PATCH] ipa-prop: Fix multiple-target speculation resolution + +Hi, + +as the FIXME which this patch removes states, the current code does +not work when a call with multiple speculative targets gets resolved +through parameter tracking during inlining - it feeds the inliner an +edge it has already dealt with. The patch makes the code which should +prevent it aware of the possibility that that speculation can have +more than one target now. + +Bootstrapped and tested and LTO bootstrapped on x86_64-linux. I did not +try profiled LTO bootstrap because it fails even without the patch (even +without Ada, just C, C++ and Fortran, at least commit 92f0d3d03a7 does). +OK for trunk? + +Thanks, + +Martin + +gcc/ChangeLog: + +2020-09-30 Martin Jambor + + PR ipa/96394 + * ipa-prop.c (update_indirect_edges_after_inlining): Do not add + resolved speculation edges to vector of new direct edges even in + presence of multiple speculative direct edges for a single call. + +gcc/testsuite/ChangeLog: + +2020-09-30 Martin Jambor + + PR ipa/96394 + * gcc.dg/tree-prof/pr96394.c: New test. +--- + gcc/ipa-prop.c | 10 ++-- + gcc/testsuite/gcc.dg/tree-prof/pr96394.c | 64 + 2 files changed, 70 insertions(+), 4 deletions(-) + create mode 100644 gcc/testsuite/gcc.dg/tree-prof/pr96394.c + +diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c +index ea88fd3fd95..0ff04d344e1 100644 +--- a/gcc/ipa-prop.c b/gcc/ipa-prop.c +@@ -3787,11 +3787,13 @@ update_indirect_edges_after_inlining (struct cgraph_edge *cs, + + param_index = ici->param_index; + jfunc = ipa_get_ith_jump_func (top, param_index); +- cgraph_node *spec_target = NULL; + +- /* FIXME: This may need updating for multiple calls. */ ++ auto_vec spec_targets; + if (ie->speculative) +- spec_target = ie->first_speculative_call_target ()->callee; ++ for (cgraph_edge *direct = ie->first_speculative_call_target (); ++ direct; ++ direct = direct->next_speculative_call_target ()) ++spec_targets.safe_push (direct->callee); + + if (!opt_for_fn (node->decl, flag_indirect_inlining)) + new_direct_edge = NULL; +@@ -3814,7 +3816,7 @@ update_indirect_edges_after_inlining (struct cgraph_edge *cs, + + /* If speculation was removed, then we need to do nothing. */ + if (new_direct_edge && new_direct_edge != ie +-&& new_direct_edge->callee == spec_target) ++&& spec_targets.contains (new_direct_edge->callee)) + { + new_direct_edge->indirect_inlining_edge = 1; + top = IPA_EDGE_REF (cs); +diff --git a/gcc/testsuite/gcc.dg/tree-prof/pr96394.c b/gcc/testsuite/gcc.dg/tree-prof/pr96394.c +new file mode 100644 +index 000..4280182a7c3 +--- /dev/null b/gcc/testsuite/gcc.dg/tree-prof/pr96394.c +@@ -0,0 +1,64 @@ ++/* PR ipa/96394 */ ++/* { dg-options "-O2" } */ ++ ++typedef struct _entry { ++int has_next; ++int next_ix; ++int count; ++} entry; ++ ++extern entry table[]; ++ ++void * ++__attribute__((noipa)) ++PyErr_Format(entry * e){ return 0; } ++ ++void ae(entry *); ++int h(entry *); ++int ap(entry *); ++int ag(entry *); ++ ++int ag(entry *j) { ++ if (j->has_next) ++h(&table[j->next_ix]); ++ return 0; ++} ++static int ai(entry *j, int k(entry *), int l, int m) { ++ int am = 1; ++ int ab; ++ ++ /* k is either 'h' or 'ap': 50%/50% */ ++ ab = k(j); ++ ++ /* loop never gets executed on real data */ ++ for (; j->count >= 2; am += 2) ++if (l) { ++ entry *i = &table[am + m]; ++ PyErr_Format(i); ++} ++ return ab; ++} ++void ++__attribute__((noipa)) ++bug() { ++ h(table); ++ h(table); ++} ++int h(entry *j) { return ai(j, ap, 4, 5); } ++int ap(entry *j) { return ai(j, ag, 14, 4); } ++ ++int main(void) ++{ ++bug(); ++} ++ ++entry
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: b4972ce62b04aafc6061836a92f0cebbadd80d7a Author: Sergei Trofimovich gentoo org> AuthorDate: Fri Oct 2 09:22:40 2020 + Commit: Sergei Trofimovich gentoo org> CommitDate: Fri Oct 2 09:22:40 2020 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=b4972ce6 10.2.0: cut 3 patchset three new patches: + 37_all_c-vector-init-PR96377.patch: fix vector init on arm + 38_all_gcov-TOPN-PR96913.patch: fix TOPN prof counters in shared libraries + 39_all_ipa-prop-multispec.patch: fix multiple speculation resolution on prof builds Bug: https://gcc.gnu.org/PR96377 Bug: https://gcc.gnu.org/PR96913 Bug: https://bugs.gentoo.org/734006 Bug: https://gcc.gnu.org/PR96394 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/README.history | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index 5929aae..86f3aae 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -1,4 +1,4 @@ -3 TODO +3 02 Oct 2020 U 28_all_EXTRA_OPTIONS-fstack-clash-protection.patch + 37_all_c-vector-init-PR96377.patch + 38_all_gcov-TOPN-PR96913.patch
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: 9b342fdeb8588681bb106e072cefd481a045fb21 Author: Sergei Trofimovich gentoo org> AuthorDate: Tue Dec 1 19:16:33 2020 + Commit: Sergei Trofimovich gentoo org> CommitDate: Tue Dec 1 19:16:33 2020 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=9b342fde 10.2.0: backport strncmp() folding Reported-by: Matt Whitlock Bug: https://bugs.gentoo.org/757792 Bug: https://gcc.gnu.org/PR96758 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/41_all_strlen-PR96758.patch | 95 +++ 10.2.0/gentoo/README.history | 3 + 2 files changed, 98 insertions(+) diff --git a/10.2.0/gentoo/41_all_strlen-PR96758.patch b/10.2.0/gentoo/41_all_strlen-PR96758.patch new file mode 100644 index 000..fccf2de --- /dev/null +++ b/10.2.0/gentoo/41_all_strlen-PR96758.patch @@ -0,0 +1,95 @@ +https://bugs.gentoo.org/757792 + +From 0dbfa88edafbe913a7a9099246041e0190aa3948 Mon Sep 17 00:00:00 2001 +From: Jakub Jelinek +Date: Tue, 25 Aug 2020 13:47:10 +0200 +Subject: [PATCH] strlen: Fix handle_builtin_string_cmp [PR96758] + +The following testcase is miscompiled, because handle_builtin_string_cmp +sees a strncmp call with constant last argument 4, where one of the strings +has an upper bound of 5 bytes (due to it being an array of that size) and +the other has a known string length of 1 and the result is used only in +equality comparison. +It is folded into __builtin_strncmp_eq (str1, str2, 4), which is +incorrect, because that means reading 4 bytes from both strings and +comparing that. When one of the strings has known strlen of 1, we want to +compare just 2 bytes, not 4, as strncmp shouldn't compare any bytes beyond +the null. +So, the last argument to __builtin_strncmp_eq should be the minimum of the +provided strncmp last argument and the known string length + 1 (assuming +the other string has only a known upper bound due to array size). + +Besides that, I've noticed the code has been written with the intent to also +support the case where we know exact string length of both strings (but not +the string content, so we can't compute it at compile time). In that case, +both cstlen1 and cstlen2 are non-negative and both arysiz1 and arysiz2 are +negative. We wouldn't optimize that, cmpsiz would be either the strncmp +last argument, or for strcmp the first string length, but varsiz would be +-1 and thus cmpsiz would be never < varsiz. The patch fixes it by using the +correct length, in that case using the minimum of the two and for strncmp +also the last argument. + +2020-08-25 Jakub Jelinek + + PR tree-optimization/96758 + * tree-ssa-strlen.c (handle_builtin_string_cmp): If both cstlen1 + and cstlen2 are set, set cmpsiz to their minimum, otherwise use the + one that is set. If bound is used and smaller than cmpsiz, set cmpsiz + to bound. If both cstlen1 and cstlen2 are set, perform the optimization. + + * gcc.dg/strcmpopt_12.c: New test. + +(cherry picked from commit f982a6ec9b6d98f5f37114b1d7455c54ce5056b8) +--- + gcc/testsuite/gcc.dg/strcmpopt_12.c | 17 + + gcc/tree-ssa-strlen.c | 10 +- + 2 files changed, 26 insertions(+), 1 deletion(-) + create mode 100644 gcc/testsuite/gcc.dg/strcmpopt_12.c + +diff --git a/gcc/testsuite/gcc.dg/strcmpopt_12.c b/gcc/testsuite/gcc.dg/strcmpopt_12.c +new file mode 100644 +index 000..d8077b62f7f +--- /dev/null b/gcc/testsuite/gcc.dg/strcmpopt_12.c +@@ -0,0 +1,17 @@ ++/* PR tree-optimization/96758 */ ++/* { dg-do run } */ ++/* { dg-options "-O2" } */ ++ ++int v = 1; ++ ++int ++main () ++{ ++ const char *s = v ? "a" : "b"; ++ char x[5]; ++ char y[5] = "a\0a"; ++ __builtin_memcpy (x, y, sizeof (y)); ++ if (__builtin_strncmp (x, s, 4) != 0) ++__builtin_abort (); ++ return 0; ++} +diff --git a/gcc/tree-ssa-strlen.c b/gcc/tree-ssa-strlen.c +index 93d095e1896..b0874da5d1e 100644 +--- a/gcc/tree-ssa-strlen.c b/gcc/tree-ssa-strlen.c +@@ -4485,7 +4485,15 @@ handle_builtin_string_cmp (gimple_stmt_iterator *gsi, const vr_values *rvals) + ++cstlen2; + + /* The exact number of characters to compare. */ +- HOST_WIDE_INT cmpsiz = bound < 0 ? cstlen1 < 0 ? cstlen2 : cstlen1 : bound; ++ HOST_WIDE_INT cmpsiz; ++ if (cstlen1 >= 0 && cstlen2 >= 0) ++cmpsiz = MIN (cstlen1, cstlen2); ++ else if (cstlen1 >= 0) ++cmpsiz = cstlen1; ++ else ++cmpsiz = cstlen2; ++ if (bound >= 0) ++cmpsiz = MIN (cmpsiz, bound); + /* The size of the array in which the unknown string is stored. */ + HOST_WIDE_INT varsiz = arysiz1 < 0 ? arysiz2 : arysiz1; + +-- +2.29.2 + diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index e0207e7..8b8c475 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -1,3 +1,6 @@ +5 TODO + + 41_all_strlen-PR96758.patch + 4 04 Nov 2020 + 40_all_ipa-to_frequency.patch
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: ff3a446afb9e0abb87869e85826454e85ef398c3 Author: Sergei Trofimovich gentoo org> AuthorDate: Mon Mar 15 22:55:21 2021 + Commit: Sergei Trofimovich gentoo org> CommitDate: Mon Mar 15 22:57:07 2021 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=ff3a446a 10.2.0: fix vtv build on slibtool Reported-by: orbea riseup.net Bug: https://gcc.gnu.org/PR99172 Bug: https://bugs.gentoo.org/767706 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/43_all_vtv-slibtool.patch | 62 + 10.2.0/gentoo/README.history| 1 + 2 files changed, 63 insertions(+) diff --git a/10.2.0/gentoo/43_all_vtv-slibtool.patch b/10.2.0/gentoo/43_all_vtv-slibtool.patch new file mode 100644 index 000..b5716f9 --- /dev/null +++ b/10.2.0/gentoo/43_all_vtv-slibtool.patch @@ -0,0 +1,62 @@ +https://bugs.gentoo.org/767706 +https://gcc.gnu.org/PR99172 + +From c2be82058fb40f3ae891c68d185ff53e07f14f45 Mon Sep 17 00:00:00 2001 +From: Caroline Tice +Date: Fri, 12 Mar 2021 07:34:36 -0800 +Subject: [PATCH] libstdc++-v3: Update VTV vars for libtool link commands + [PR99172] + +This fixes PR 99172 + +Currently when GCC is configured with --enable-vtable-verify, the +libstdc++-v3 Makefiles add "-fvtable-verify=std +-Wl,-u_vtable_map_vars_start,-u_vtable_map_vars_end" to libtool link +commands. The "-fvtable-verify=std" piece causes alternate versions of +libtool (such as slibtool) to fail, unable to find "-lvtv" (GNU +libtool just removes that piece). + +This patch updates the libstdc++-v3 Makefiles to not pass +"-fvtable-verify=std" to the libtool link commands. +--- + libstdc++-v3/src/Makefile.am | 4 +++- + libstdc++-v3/src/Makefile.in | 3 ++- + +--- a/libstdc++-v3/src/Makefile.am b/libstdc++-v3/src/Makefile.am +@@ -214,12 +214,14 @@ compatibility-condvar.o: compatibility-condvar.cc + # set this option because CONFIG_CXXFLAGS has to be after + # OPTIMIZE_CXXFLAGS on the compile line so that -O2 can be overridden + # as the occasion calls for it. +-AM_CXXFLAGS = \ ++AM_CXXFLAGS_PRE = \ + -std=gnu++98 \ + $(glibcxx_compiler_pic_flag) \ + $(XTEMPLATE_FLAGS) $(VTV_CXXFLAGS) \ + $(WARN_CXXFLAGS) $(OPTIMIZE_CXXFLAGS) $(CONFIG_CXXFLAGS) + ++AM_CXXFLAGS = $(filter-out -fvtable-verify=std,$(AM_CXXFLAGS_PRE)) ++ + # Libtool notes + + # 1) In general, libtool expects an argument such as `--tag=CXX' when +--- a/libstdc++-v3/src/Makefile.in b/libstdc++-v3/src/Makefile.in +@@ -578,12 +578,13 @@ libstdc___la_LINK = $(CXXLINK) $(libstdc___la_LDFLAGS) $(lt_host_flags) + # set this option because CONFIG_CXXFLAGS has to be after + # OPTIMIZE_CXXFLAGS on the compile line so that -O2 can be overridden + # as the occasion calls for it. +-AM_CXXFLAGS = \ ++AM_CXXFLAGS_PRE = \ + -std=gnu++98 \ + $(glibcxx_compiler_pic_flag) \ + $(XTEMPLATE_FLAGS) $(VTV_CXXFLAGS) \ + $(WARN_CXXFLAGS) $(OPTIMIZE_CXXFLAGS) $(CONFIG_CXXFLAGS) + ++AM_CXXFLAGS = $(filter-out -fvtable-verify=std,$(AM_CXXFLAGS_PRE)) + + # Libtool notes + +-- +2.30.2 + diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index 4ca261a..f195ae9 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -1,5 +1,6 @@ 7 TODO + 42_all_vmat-PR97236.patch + + 43_all_vtv-slibtool.patch 6 29 Dec 2020 - 34_all_fundecl-ICE-PR95820.patch
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: 9b342fdeb8588681bb106e072cefd481a045fb21 Author: Sergei Trofimovich gentoo org> AuthorDate: Tue Dec 1 19:16:33 2020 + Commit: Sergei Trofimovich gentoo org> CommitDate: Tue Dec 1 19:16:33 2020 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=9b342fde 10.2.0: backport strncmp() folding Reported-by: Matt Whitlock Bug: https://bugs.gentoo.org/757792 Bug: https://gcc.gnu.org/PR96758 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/41_all_strlen-PR96758.patch | 95 +++ 10.2.0/gentoo/README.history | 3 + 2 files changed, 98 insertions(+) diff --git a/10.2.0/gentoo/41_all_strlen-PR96758.patch b/10.2.0/gentoo/41_all_strlen-PR96758.patch new file mode 100644 index 000..fccf2de --- /dev/null +++ b/10.2.0/gentoo/41_all_strlen-PR96758.patch @@ -0,0 +1,95 @@ +https://bugs.gentoo.org/757792 + +From 0dbfa88edafbe913a7a9099246041e0190aa3948 Mon Sep 17 00:00:00 2001 +From: Jakub Jelinek +Date: Tue, 25 Aug 2020 13:47:10 +0200 +Subject: [PATCH] strlen: Fix handle_builtin_string_cmp [PR96758] + +The following testcase is miscompiled, because handle_builtin_string_cmp +sees a strncmp call with constant last argument 4, where one of the strings +has an upper bound of 5 bytes (due to it being an array of that size) and +the other has a known string length of 1 and the result is used only in +equality comparison. +It is folded into __builtin_strncmp_eq (str1, str2, 4), which is +incorrect, because that means reading 4 bytes from both strings and +comparing that. When one of the strings has known strlen of 1, we want to +compare just 2 bytes, not 4, as strncmp shouldn't compare any bytes beyond +the null. +So, the last argument to __builtin_strncmp_eq should be the minimum of the +provided strncmp last argument and the known string length + 1 (assuming +the other string has only a known upper bound due to array size). + +Besides that, I've noticed the code has been written with the intent to also +support the case where we know exact string length of both strings (but not +the string content, so we can't compute it at compile time). In that case, +both cstlen1 and cstlen2 are non-negative and both arysiz1 and arysiz2 are +negative. We wouldn't optimize that, cmpsiz would be either the strncmp +last argument, or for strcmp the first string length, but varsiz would be +-1 and thus cmpsiz would be never < varsiz. The patch fixes it by using the +correct length, in that case using the minimum of the two and for strncmp +also the last argument. + +2020-08-25 Jakub Jelinek + + PR tree-optimization/96758 + * tree-ssa-strlen.c (handle_builtin_string_cmp): If both cstlen1 + and cstlen2 are set, set cmpsiz to their minimum, otherwise use the + one that is set. If bound is used and smaller than cmpsiz, set cmpsiz + to bound. If both cstlen1 and cstlen2 are set, perform the optimization. + + * gcc.dg/strcmpopt_12.c: New test. + +(cherry picked from commit f982a6ec9b6d98f5f37114b1d7455c54ce5056b8) +--- + gcc/testsuite/gcc.dg/strcmpopt_12.c | 17 + + gcc/tree-ssa-strlen.c | 10 +- + 2 files changed, 26 insertions(+), 1 deletion(-) + create mode 100644 gcc/testsuite/gcc.dg/strcmpopt_12.c + +diff --git a/gcc/testsuite/gcc.dg/strcmpopt_12.c b/gcc/testsuite/gcc.dg/strcmpopt_12.c +new file mode 100644 +index 000..d8077b62f7f +--- /dev/null b/gcc/testsuite/gcc.dg/strcmpopt_12.c +@@ -0,0 +1,17 @@ ++/* PR tree-optimization/96758 */ ++/* { dg-do run } */ ++/* { dg-options "-O2" } */ ++ ++int v = 1; ++ ++int ++main () ++{ ++ const char *s = v ? "a" : "b"; ++ char x[5]; ++ char y[5] = "a\0a"; ++ __builtin_memcpy (x, y, sizeof (y)); ++ if (__builtin_strncmp (x, s, 4) != 0) ++__builtin_abort (); ++ return 0; ++} +diff --git a/gcc/tree-ssa-strlen.c b/gcc/tree-ssa-strlen.c +index 93d095e1896..b0874da5d1e 100644 +--- a/gcc/tree-ssa-strlen.c b/gcc/tree-ssa-strlen.c +@@ -4485,7 +4485,15 @@ handle_builtin_string_cmp (gimple_stmt_iterator *gsi, const vr_values *rvals) + ++cstlen2; + + /* The exact number of characters to compare. */ +- HOST_WIDE_INT cmpsiz = bound < 0 ? cstlen1 < 0 ? cstlen2 : cstlen1 : bound; ++ HOST_WIDE_INT cmpsiz; ++ if (cstlen1 >= 0 && cstlen2 >= 0) ++cmpsiz = MIN (cstlen1, cstlen2); ++ else if (cstlen1 >= 0) ++cmpsiz = cstlen1; ++ else ++cmpsiz = cstlen2; ++ if (bound >= 0) ++cmpsiz = MIN (cmpsiz, bound); + /* The size of the array in which the unknown string is stored. */ + HOST_WIDE_INT varsiz = arysiz1 < 0 ? arysiz2 : arysiz1; + +-- +2.29.2 + diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index e0207e7..8b8c475 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -1,3 +1,6 @@ +5 TODO + + 41_all_strlen-PR96758.patch + 4 04 Nov 2020 + 40_all_ipa-to_frequency.patch
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: bb31009f6bb62d2dbee6a4be9605c9286ef0df23 Author: Sergei Trofimovich gentoo org> AuthorDate: Thu Oct 15 17:30:51 2020 + Commit: Sergei Trofimovich gentoo org> CommitDate: Thu Oct 15 17:30:51 2020 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=bb31009f 10.2.0: backport IPA to_frequency() ICE Reported-by: inasprecali disroot.org Bug: https://bugs.gentoo.org/746578 Bug: https://gcc.gnu.org/PR97295 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/40_all_ipa-to_frequency.patch | 48 + 10.2.0/gentoo/README.history| 3 ++ 2 files changed, 51 insertions(+) diff --git a/10.2.0/gentoo/40_all_ipa-to_frequency.patch b/10.2.0/gentoo/40_all_ipa-to_frequency.patch new file mode 100644 index 000..0849207 --- /dev/null +++ b/10.2.0/gentoo/40_all_ipa-to_frequency.patch @@ -0,0 +1,48 @@ +https://bugs.gentoo.org/746578 +https://gcc.gnu.org/PR97295 + +From 508e2d88a4c512e8b8685cf5ba201ad48e6bb58d Mon Sep 17 00:00:00 2001 +From: Martin Liska +Date: Tue, 13 Oct 2020 16:44:47 +0200 +Subject: [PATCH] IPA: fix profile handling in IRA + +gcc/ChangeLog: + + PR ipa/97295 + * profile-count.c (profile_count::to_frequency): Move part of + gcc_assert to STATIC_ASSERT. + * regs.h (REG_FREQ_FROM_BB): Do not use count.to_frequency for + a function that does not have count_max initialized. +--- + gcc/profile-count.c | 4 ++-- + gcc/regs.h | 3 ++- + 2 files changed, 4 insertions(+), 3 deletions(-) + +--- a/gcc/profile-count.c b/gcc/profile-count.c +@@ -270,8 +270,8 @@ profile_count::to_frequency (struct function *fun) const + return BB_FREQ_MAX; + if (*this == zero ()) + return 0; +- gcc_assert (REG_BR_PROB_BASE == BB_FREQ_MAX +-&& fun->cfg->count_max.initialized_p ()); ++ STATIC_ASSERT (REG_BR_PROB_BASE == BB_FREQ_MAX); ++ gcc_assert (fun->cfg->count_max.initialized_p ()); + profile_probability prob = probability_in (fun->cfg->count_max); + if (!prob.initialized_p ()) + return REG_BR_PROB_BASE; +--- a/gcc/regs.h b/gcc/regs.h +@@ -128,7 +128,8 @@ extern size_t reg_info_p_size; +or profile driven feedback is available and the function is never executed, +frequency is always equivalent. Otherwise rescale the basic block +frequency. */ +-#define REG_FREQ_FROM_BB(bb) (optimize_function_for_size_p (cfun) \ ++#define REG_FREQ_FROM_BB(bb) ((optimize_function_for_size_p (cfun) \ ++ || !cfun->cfg->count_max.initialized_p ()) \ + ? REG_FREQ_MAX \ + : ((bb)->count.to_frequency (cfun) \ + * REG_FREQ_MAX / BB_FREQ_MAX) \ +-- +2.28.0 + diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index 86f3aae..e419e62 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -1,3 +1,6 @@ +4 TODO + + 40_all_ipa-to_frequency.patch + 3 02 Oct 2020 U 28_all_EXTRA_OPTIONS-fstack-clash-protection.patch + 37_all_c-vector-init-PR96377.patch
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: 50322c7c5fb8f869f45f8dd23a89f4a7c4b8ba2d Author: Sergei Trofimovich gentoo org> AuthorDate: Thu Apr 8 19:36:03 2021 + Commit: Sergei Trofimovich gentoo org> CommitDate: Thu Apr 8 19:36:03 2021 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=50322c7c 10.2.0: revert "port binutils fix for CET detection on i486" The patch is not ready for prime time. Le't pull newer upstream version a bit later. This reverts commit 5600e4343f36e2a4925b09388d3ffe7400143b9f. Reported-by: Worx Bug: https://bugs.gentoo.org/777117 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/44_all_cet-i486.patch | 109 10.2.0/gentoo/README.history| 1 - 2 files changed, 110 deletions(-) diff --git a/10.2.0/gentoo/44_all_cet-i486.patch b/10.2.0/gentoo/44_all_cet-i486.patch deleted file mode 100644 index 956e439..000 --- a/10.2.0/gentoo/44_all_cet-i486.patch +++ /dev/null @@ -1,109 +0,0 @@ -https://bugs.gentoo.org/777117 - -From 267a609477624ade477994b24809a72eeb522ff1 Mon Sep 17 00:00:00 2001 -From: "H.J. Lu via Gcc-patches" -Date: Sun, 14 Feb 2021 09:26:40 -0800 -Subject: [PATCH 2/2] GCC_CET_HOST_FLAGS: Check if host supports multi-byte - NOPs - -Check if host supports multi-byte NOPs before enabling CET on host. - -config/ - - PR binutils/27397 - * cet.m4 (GCC_CET_HOST_FLAGS): Check if host supports multi-byte - NOPs. - -libiberty/ - - PR binutils/27397 - * configure: Regenerated. - - config/cet.m4 | 19 --- - libiberty/configure | 29 + - 2 files changed, 45 insertions(+), 3 deletions(-) - a/config/cet.m4 -+++ b/config/cet.m4 -@@ -130,6 +130,18 @@ fi - if test x$may_have_cet = xyes; then - if test x$cross_compiling = xno; then - AC_TRY_RUN([ -+int -+main () -+{ -+ asm ("endbr32"); -+ return 0; -+} -+], -+[have_multi_byte_nop=yes], -+[have_multi_byte_nop=no]) -+have_cet=no -+if test x$have_multi_byte_nop = xyes; then -+ AC_TRY_RUN([ - static void - foo (void) - { -@@ -155,9 +167,10 @@ main () - bar (); - return 0; - } --], --[have_cet=no], --[have_cet=yes]) -+ ], -+ [have_cet=no], -+ [have_cet=yes]) -+fi - if test x$enable_cet = xno -a x$have_cet = xyes; then - AC_MSG_ERROR([Intel CET must be enabled on Intel CET enabled host]) - fi a/libiberty/configure -+++ b/libiberty/configure -@@ -5396,6 +5396,34 @@ else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext - /* end confdefs.h. */ - -+int -+main () -+{ -+ asm ("endbr32"); -+ return 0; -+} -+ -+_ACEOF -+if ac_fn_c_try_run "$LINENO"; then : -+ have_multi_byte_nop=yes -+else -+ have_multi_byte_nop=no -+fi -+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ -+ conftest.$ac_objext conftest.beam conftest.$ac_ext -+fi -+ -+have_cet=no -+if test x$have_multi_byte_nop = xyes; then -+ if test "$cross_compiling" = yes; then : -+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -+as_fn_error $? "cannot run test program while cross compiling -+See \`config.log' for more details" "$LINENO" 5; } -+else -+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext -+/* end confdefs.h. */ -+ - static void - foo (void) - { -@@ -5432,6 +5460,7 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext - fi - -+fi - if test x$enable_cet = xno -a x$have_cet = xyes; then - as_fn_error $? "Intel CET must be enabled on Intel CET enabled host" "$LINENO" 5 - fi --- -2.31.0 - diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index f47a108..f195ae9 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -1,7 +1,6 @@ 7 TODO + 42_all_vmat-PR97236.patch + 43_all_vtv-slibtool.patch - + 44_all_cet-i486.patch 6 29 Dec 2020 - 34_all_fundecl-ICE-PR95820.patch
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: ff3a446afb9e0abb87869e85826454e85ef398c3 Author: Sergei Trofimovich gentoo org> AuthorDate: Mon Mar 15 22:55:21 2021 + Commit: Sergei Trofimovich gentoo org> CommitDate: Mon Mar 15 22:57:07 2021 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=ff3a446a 10.2.0: fix vtv build on slibtool Reported-by: orbea riseup.net Bug: https://gcc.gnu.org/PR99172 Bug: https://bugs.gentoo.org/767706 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/43_all_vtv-slibtool.patch | 62 + 10.2.0/gentoo/README.history| 1 + 2 files changed, 63 insertions(+) diff --git a/10.2.0/gentoo/43_all_vtv-slibtool.patch b/10.2.0/gentoo/43_all_vtv-slibtool.patch new file mode 100644 index 000..b5716f9 --- /dev/null +++ b/10.2.0/gentoo/43_all_vtv-slibtool.patch @@ -0,0 +1,62 @@ +https://bugs.gentoo.org/767706 +https://gcc.gnu.org/PR99172 + +From c2be82058fb40f3ae891c68d185ff53e07f14f45 Mon Sep 17 00:00:00 2001 +From: Caroline Tice +Date: Fri, 12 Mar 2021 07:34:36 -0800 +Subject: [PATCH] libstdc++-v3: Update VTV vars for libtool link commands + [PR99172] + +This fixes PR 99172 + +Currently when GCC is configured with --enable-vtable-verify, the +libstdc++-v3 Makefiles add "-fvtable-verify=std +-Wl,-u_vtable_map_vars_start,-u_vtable_map_vars_end" to libtool link +commands. The "-fvtable-verify=std" piece causes alternate versions of +libtool (such as slibtool) to fail, unable to find "-lvtv" (GNU +libtool just removes that piece). + +This patch updates the libstdc++-v3 Makefiles to not pass +"-fvtable-verify=std" to the libtool link commands. +--- + libstdc++-v3/src/Makefile.am | 4 +++- + libstdc++-v3/src/Makefile.in | 3 ++- + +--- a/libstdc++-v3/src/Makefile.am b/libstdc++-v3/src/Makefile.am +@@ -214,12 +214,14 @@ compatibility-condvar.o: compatibility-condvar.cc + # set this option because CONFIG_CXXFLAGS has to be after + # OPTIMIZE_CXXFLAGS on the compile line so that -O2 can be overridden + # as the occasion calls for it. +-AM_CXXFLAGS = \ ++AM_CXXFLAGS_PRE = \ + -std=gnu++98 \ + $(glibcxx_compiler_pic_flag) \ + $(XTEMPLATE_FLAGS) $(VTV_CXXFLAGS) \ + $(WARN_CXXFLAGS) $(OPTIMIZE_CXXFLAGS) $(CONFIG_CXXFLAGS) + ++AM_CXXFLAGS = $(filter-out -fvtable-verify=std,$(AM_CXXFLAGS_PRE)) ++ + # Libtool notes + + # 1) In general, libtool expects an argument such as `--tag=CXX' when +--- a/libstdc++-v3/src/Makefile.in b/libstdc++-v3/src/Makefile.in +@@ -578,12 +578,13 @@ libstdc___la_LINK = $(CXXLINK) $(libstdc___la_LDFLAGS) $(lt_host_flags) + # set this option because CONFIG_CXXFLAGS has to be after + # OPTIMIZE_CXXFLAGS on the compile line so that -O2 can be overridden + # as the occasion calls for it. +-AM_CXXFLAGS = \ ++AM_CXXFLAGS_PRE = \ + -std=gnu++98 \ + $(glibcxx_compiler_pic_flag) \ + $(XTEMPLATE_FLAGS) $(VTV_CXXFLAGS) \ + $(WARN_CXXFLAGS) $(OPTIMIZE_CXXFLAGS) $(CONFIG_CXXFLAGS) + ++AM_CXXFLAGS = $(filter-out -fvtable-verify=std,$(AM_CXXFLAGS_PRE)) + + # Libtool notes + +-- +2.30.2 + diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index 4ca261a..f195ae9 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -1,5 +1,6 @@ 7 TODO + 42_all_vmat-PR97236.patch + + 43_all_vtv-slibtool.patch 6 29 Dec 2020 - 34_all_fundecl-ICE-PR95820.patch
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: 5600e4343f36e2a4925b09388d3ffe7400143b9f Author: Sergei Trofimovich gentoo org> AuthorDate: Fri Mar 19 08:01:22 2021 + Commit: Sergei Trofimovich gentoo org> CommitDate: Fri Mar 19 08:01:22 2021 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=5600e434 10.2.0: port binutils fix for CET detection on i486 Reported-by: Worx Bug: https://bugs.gentoo.org/777117 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/44_all_cet-i486.patch | 109 10.2.0/gentoo/README.history| 1 + 2 files changed, 110 insertions(+) diff --git a/10.2.0/gentoo/44_all_cet-i486.patch b/10.2.0/gentoo/44_all_cet-i486.patch new file mode 100644 index 000..956e439 --- /dev/null +++ b/10.2.0/gentoo/44_all_cet-i486.patch @@ -0,0 +1,109 @@ +https://bugs.gentoo.org/777117 + +From 267a609477624ade477994b24809a72eeb522ff1 Mon Sep 17 00:00:00 2001 +From: "H.J. Lu via Gcc-patches" +Date: Sun, 14 Feb 2021 09:26:40 -0800 +Subject: [PATCH 2/2] GCC_CET_HOST_FLAGS: Check if host supports multi-byte + NOPs + +Check if host supports multi-byte NOPs before enabling CET on host. + +config/ + + PR binutils/27397 + * cet.m4 (GCC_CET_HOST_FLAGS): Check if host supports multi-byte + NOPs. + +libiberty/ + + PR binutils/27397 + * configure: Regenerated. + +--- + config/cet.m4 | 19 --- + libiberty/configure | 29 + + 2 files changed, 45 insertions(+), 3 deletions(-) + +--- a/config/cet.m4 b/config/cet.m4 +@@ -130,6 +130,18 @@ fi + if test x$may_have_cet = xyes; then + if test x$cross_compiling = xno; then + AC_TRY_RUN([ ++int ++main () ++{ ++ asm ("endbr32"); ++ return 0; ++} ++], ++[have_multi_byte_nop=yes], ++[have_multi_byte_nop=no]) ++have_cet=no ++if test x$have_multi_byte_nop = xyes; then ++ AC_TRY_RUN([ + static void + foo (void) + { +@@ -155,9 +167,10 @@ main () + bar (); + return 0; + } +-], +-[have_cet=no], +-[have_cet=yes]) ++ ], ++ [have_cet=no], ++ [have_cet=yes]) ++fi + if test x$enable_cet = xno -a x$have_cet = xyes; then + AC_MSG_ERROR([Intel CET must be enabled on Intel CET enabled host]) + fi +--- a/libiberty/configure b/libiberty/configure +@@ -5396,6 +5396,34 @@ else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ + ++int ++main () ++{ ++ asm ("endbr32"); ++ return 0; ++} ++ ++_ACEOF ++if ac_fn_c_try_run "$LINENO"; then : ++ have_multi_byte_nop=yes ++else ++ have_multi_byte_nop=no ++fi ++rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ ++ conftest.$ac_objext conftest.beam conftest.$ac_ext ++fi ++ ++have_cet=no ++if test x$have_multi_byte_nop = xyes; then ++ if test "$cross_compiling" = yes; then : ++ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 ++$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} ++as_fn_error $? "cannot run test program while cross compiling ++See \`config.log' for more details" "$LINENO" 5; } ++else ++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext ++/* end confdefs.h. */ ++ + static void + foo (void) + { +@@ -5432,6 +5460,7 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext + fi + ++fi + if test x$enable_cet = xno -a x$have_cet = xyes; then + as_fn_error $? "Intel CET must be enabled on Intel CET enabled host" "$LINENO" 5 + fi +-- +2.31.0 + diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index f195ae9..f47a108 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -1,6 +1,7 @@ 7 TODO + 42_all_vmat-PR97236.patch + 43_all_vtv-slibtool.patch + + 44_all_cet-i486.patch 6 29 Dec 2020 - 34_all_fundecl-ICE-PR95820.patch
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: bb00f570a7d3f1d0e4233f8d353fb9c56f3a55cc Author: Sergei Trofimovich gentoo org> AuthorDate: Thu Sep 10 21:37:36 2020 + Commit: Sergei Trofimovich gentoo org> CommitDate: Thu Sep 10 21:37:36 2020 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=bb00f570 10.2.0: fix TOPN counters when logged from shared library The change does not yet fix underlying problem of recursive inliner. Bug: https://gcc.gnu.org/PR96913 Bug: https://gcc.gnu.org/PR96394 Bug: https://bugs.gentoo.org/734006 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/38_all_gcov-TOPN-PR96913.patch | 42 10.2.0/gentoo/README.history | 1 + 2 files changed, 43 insertions(+) diff --git a/10.2.0/gentoo/38_all_gcov-TOPN-PR96913.patch b/10.2.0/gentoo/38_all_gcov-TOPN-PR96913.patch new file mode 100644 index 000..5c301e4 --- /dev/null +++ b/10.2.0/gentoo/38_all_gcov-TOPN-PR96913.patch @@ -0,0 +1,42 @@ +https://gcc.gnu.org/PR96913 +https://gcc.gnu.org/PR96394 +https://bugs.gentoo.org/734006 + +From ae887148e112e018bec0bab5bc15e53f2225037a Mon Sep 17 00:00:00 2001 +From: Sergei Trofimovich +Date: Sun, 6 Sep 2020 12:13:54 +0100 +Subject: [PATCH] gcov: fix TOPN streaming from shared libraries + +Before the change gcc did not stream correctly TOPN counters +if counters belonged to a non-local shared object. + +As a result zero-section optimization generated TOPN sections +in a form not recognizable by '__gcov_merge_topn'. + +The problem happens because in a case of multiple shared objects +'__gcov_merge_topn' function is present in address space multiple +times (once per each object). + +The fix is to never rely on function address and predicate on TOPN +counter types. + +libgcc/ChangeLog: + + PR gcov-profile/96913 + * libgcov-driver.c (write_one_data): Avoid function pointer + comparison in TOP streaming decision. +--- + libgcc/libgcov-driver.c | 7 ++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +--- a/libgcc/libgcov-driver.c b/libgcc/libgcov-driver.c +@@ -242,7 +242,7 @@ prune_counters (struct gcov_info *gi) + if (gi->merge[j] == NULL) + continue; + +-if (gi->merge[j] == __gcov_merge_topn) ++if (j == GCOV_COUNTER_V_TOPN || j == GCOV_COUNTER_V_INDIR) + { + gcc_assert (!(ci->num % GCOV_TOPN_VALUES_COUNTERS)); + for (unsigned k = 0; k < (ci->num / GCOV_TOPN_VALUES_COUNTERS); diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index 3fbcbfd..6d00c5a 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -1,6 +1,7 @@ 3 TODO U 28_all_EXTRA_OPTIONS-fstack-clash-protection.patch + 37_all_c-vector-init-PR96377.patch + + 38_all_gcov-TOPN-PR96913.patch 2 23 Aug 2020 + 33_all_lto-O0-mix-ICE-ipa-PR96291.patch
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: 7ecc76113ad46206cbe6e8bdc1ca39bee97be4dd Author: Sergei Trofimovich gentoo org> AuthorDate: Thu Sep 3 17:11:15 2020 + Commit: Sergei Trofimovich gentoo org> CommitDate: Thu Sep 3 17:11:15 2020 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=7ecc7611 10.2.0: backport PR96377 (c vector init syntax) Bug: https://gcc.gnu.org/PR96377 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/37_all_c-vector-init-PR96377.patch | 522 +++ 10.2.0/gentoo/README.history | 1 + 2 files changed, 523 insertions(+) diff --git a/10.2.0/gentoo/37_all_c-vector-init-PR96377.patch b/10.2.0/gentoo/37_all_c-vector-init-PR96377.patch new file mode 100644 index 000..7ef9cdd --- /dev/null +++ b/10.2.0/gentoo/37_all_c-vector-init-PR96377.patch @@ -0,0 +1,522 @@ +https://gcc.gnu.org/PR96377 + +From a216daaa30bc8949086a16e7656f2025b692d03c Mon Sep 17 00:00:00 2001 +From: Richard Sandiford +Date: Mon, 3 Aug 2020 09:48:36 +0100 +Subject: [PATCH] c: Fix bogus vector initialisation error [PR96377] + +One of the problems in this PR was that if we had: + + vector_type1 array[] = { vector_value1 }; + +process_init_element would only treat vector_value1 as initialising +a vector_type1 if they had the same TYPE_MAIN_VARIANT. This has +several problems: + +(1) It gives confusing error messages if the vector types are +incompatible. (Tested by gcc.dg/pr96377-1.c.) + +(2) It means that we reject code that should be valid with +-flax-vector-conversions. (Tested by gcc.dg/pr96377-2.c.) + +(3) On arm and aarch64 targets, it means that we reject some +initializers that mix Advanced SIMD and standard GNU vectors. +These vectors have traditionally had different TYPE_MAIN_VARIANTs +because they have different mangling schemes. (Tested by +gcc.dg/pr96377-[3-6].c.) + +(4) It means that we reject SVE initializers that should be valid. +(Tested by gcc.target/aarch64/sve/gnu_vectors_[34].c.) + +(5) After r11-1741-g:31427b974ed7b7dd54e2 we reject: + + arm_neon_type1 array[] = { k ^ arm_neon_value1 }; + +because applying the binary operator to arm_neon_value1 strips +the "Advanced SIMD type" attributes that were added in that patch. +Stripping the attributes is problematic for other reasons though, +so that still needs to be fixed separately. + +g++.target/aarch64/sve/gnu_vectors_[34].C already pass. + +gcc/c/ + PR c/96377 + * c-typeck.c (process_init_element): Split test for whether to + recurse into a record, union or array into... + (initialize_elementwise_p): ...this new function. Don't recurse + into a vector type if the initialization value is also a vector. + +gcc/testsuite/ + PR c/96377 + * gcc.dg/pr96377-1.c: New test. + * gcc.dg/pr96377-2.c: Likewise. + * gcc.dg/pr96377-3.c: Likewise. + * gcc.dg/pr96377-4.c: Likewise. + * gcc.dg/pr96377-5.c: Likewise. + * gcc.dg/pr96377-6.c: Likewise. + * gcc.target/aarch64/pr96377-1.c: Likewise. + * gcc.target/aarch64/sve/acle/general-c/gnu_vectors_3.c: Likewise. + * gcc.target/aarch64/sve/acle/general-c/gnu_vectors_4.c: Likewise. + * g++.target/aarch64/sve/acle/general-c++/gnu_vectors_3.C: Likewise. + * g++.target/aarch64/sve/acle/general-c++/gnu_vectors_4.C: Likewise. + +(cherry picked from commit 7d599ad27b9bcf5165f87710f1abc64bbabd06ae) +--- + gcc/c/c-typeck.c | 59 ++- + .../sve/acle/general-c++/gnu_vectors_3.C | 15 + + .../sve/acle/general-c++/gnu_vectors_4.C | 15 + + gcc/testsuite/gcc.dg/pr96377-1.c | 32 ++ + gcc/testsuite/gcc.dg/pr96377-2.c | 31 ++ + gcc/testsuite/gcc.dg/pr96377-3.c | 33 +++ + gcc/testsuite/gcc.dg/pr96377-4.c | 32 ++ + gcc/testsuite/gcc.dg/pr96377-5.c | 33 +++ + gcc/testsuite/gcc.dg/pr96377-6.c | 32 ++ + gcc/testsuite/gcc.target/aarch64/pr96377-1.c | 20 +++ + .../sve/acle/general-c/gnu_vectors_3.c| 15 + + .../sve/acle/general-c/gnu_vectors_4.c| 15 + + 12 files changed, 317 insertions(+), 15 deletions(-) + create mode 100644 gcc/testsuite/g++.target/aarch64/sve/acle/general-c++/gnu_vectors_3.C + create mode 100644 gcc/testsuite/g++.target/aarch64/sve/acle/general-c++/gnu_vectors_4.C + create mode 100644 gcc/testsuite/gcc.dg/pr96377-1.c + create mode 100644 gcc/testsuite/gcc.dg/pr96377-2.c + create mode 100644 gcc/testsuite/gcc.dg/pr96377-3.c + create mode 100644 gcc/testsuite/gcc.dg/pr96377-4.c + create mode 100644 gcc/testsuite/gcc.dg/pr96377-5.c + create mode 100644 gcc/testsuite/gcc.dg/pr96377-6.c + create mode 100644 gcc/testsuite/gcc.target/aarch64/pr96377-1.c + create mode 100644 gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/gnu_vectors_3.c + create mode 100644 gcc/testsuite/gcc.target/aarch64/sve
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: c446f6f37e5a5f0867527acdb0b78333e3b70822 Author: Sergei Trofimovich gentoo org> AuthorDate: Thu Aug 13 08:39:49 2020 + Commit: Sergei Trofimovich gentoo org> CommitDate: Thu Aug 13 08:39:49 2020 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=c446f6f3 10.2.0:backport ipa-cp bit fix (PR/96482) Reported-by: Johannes Hirte Bug: https://bugs.gentoo.org/736685 Bug: https://gcc.gnu.org/PR96482 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/35_all_ipa-fix-bit-CP.patch | 145 ++ 10.2.0/gentoo/README.history | 1 + 2 files changed, 146 insertions(+) diff --git a/10.2.0/gentoo/35_all_ipa-fix-bit-CP.patch b/10.2.0/gentoo/35_all_ipa-fix-bit-CP.patch new file mode 100644 index 000..34a1fe0 --- /dev/null +++ b/10.2.0/gentoo/35_all_ipa-fix-bit-CP.patch @@ -0,0 +1,145 @@ +https://bugs.gentoo.org/736685 +https://gcc.gnu.org/PR96482 + +From 66780083a0e79e5cb7c3acc8665aa47be4084a67 Mon Sep 17 00:00:00 2001 +From: Martin Liska +Date: Wed, 12 Aug 2020 09:21:51 +0200 +Subject: [PATCH] ipa: fix bit CPP when combined with IPA bit CP + +As mentioned in the PR, let's consider the following example: + +int +__attribute__((noinline)) +foo(int arg) +{ + if (arg == 3) +return 1; + if (arg == 4) +return 123; + + __builtin_unreachable (); +} + +during WPA we find all calls of the function +(yes the call with value 5 is UBSAN): + + Node: foo/0: +param [0]: 5 [loc_time: 4, loc_size: 2, prop_time: 0, prop_size: 0] + 3 [loc_time: 3, loc_size: 3, prop_time: 0, prop_size: 0] + ctxs: VARIABLE + Bits: value = 0x5, mask = 0x6 + +in LTRANS we have the following VRP info: + + # RANGE [3, 3] NONZERO 3 + +when we AND masks in get_default_value we end up with 6 & 3 = 2 (0x010). +That means the only second (least significant bit) is unknown and +value (5 = 0x101) & ~mask gives us either 7 (0x111) or 5 (0x101). + +That's why if (arg_2(D) == 3) gets optimized to false. + +gcc/ChangeLog: + + PR ipa/96482 + * ipa-cp.c (ipcp_bits_lattice::meet_with_1): Drop value bits + for bits that are unknown. + (ipcp_bits_lattice::set_to_constant): Likewise. + * tree-ssa-ccp.c (get_default_value): Add sanity check that + IPA CP bit info has all bits set to zero in bits that + are unknown. + +gcc/testsuite/ChangeLog: + + PR ipa/96482 + * gcc.dg/ipa/pr96482.c: New test. + +(cherry picked from commit d58f078ce2d53e5dab6b3d0d5f960504268e1894) +--- + gcc/ipa-cp.c | 3 +- + gcc/testsuite/gcc.dg/ipa/pr96482.c | 44 ++ + gcc/tree-ssa-ccp.c | 3 ++ + 3 files changed, 49 insertions(+), 1 deletion(-) + create mode 100644 gcc/testsuite/gcc.dg/ipa/pr96482.c + +--- a/gcc/ipa-cp.c b/gcc/ipa-cp.c +@@ -1010,7 +1010,7 @@ ipcp_bits_lattice::set_to_constant (widest_int value, widest_int mask) + { + gcc_assert (top_p ()); + m_lattice_val = IPA_BITS_CONSTANT; +- m_value = value; ++ m_value = wi::bit_and (wi::bit_not (mask), value); + m_mask = mask; + return true; + } +@@ -1047,6 +1047,7 @@ ipcp_bits_lattice::meet_with_1 (widest_int value, widest_int mask, + + widest_int old_mask = m_mask; + m_mask = (m_mask | mask) | (m_value ^ value); ++ m_value &= value; + + if (wi::sext (m_mask, precision) == -1) + return set_to_bottom (); +--- /dev/null b/gcc/testsuite/gcc.dg/ipa/pr96482.c +@@ -0,0 +1,44 @@ ++/* PR ipa/96482 */ ++/* { dg-do run } */ ++/* { dg-options "-O2 -flto" } */ ++/* { dg-require-effective-target lto } */ ++ ++int ++__attribute__((noinline)) ++foo(int arg) ++{ ++ if (arg == 3) ++return 1; ++ if (arg == 4) ++return 123; ++ ++ __builtin_unreachable (); ++} ++ ++int ++__attribute__((noinline)) ++baz(int x) ++{ ++ if (x != 0) ++return foo(3); /* called */ ++ ++ return 1; ++} ++ ++int ++__attribute__((noinline)) ++bar(int x) ++{ ++ if (x == 0) ++return foo(5); /* not executed */ ++ ++ return 1; ++} ++ ++int main(int argc, char **argv) ++{ ++ if (bar(argc) != baz(argc)) ++__builtin_abort (); ++ ++ return 0; ++} +--- a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c +@@ -306,6 +306,9 @@ get_default_value (tree var) + { + val.lattice_val = CONSTANT; + val.value = value; ++widest_int ipa_value = wi::to_widest (value); ++/* Unknown bits from IPA CP must be equal to zero. */ ++gcc_assert (wi::bit_and (ipa_value, mask) == 0); + val.mask = mask; + if (nonzero_bits != -1) + val.mask &= extend_mask (nonzero_bits, +-- +2.28.0 + diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index 7cde6a3..49edda3 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -1,6 +1,7 @@ 2 TODO + 33_all_lto-O0-mix-ICE-ipa-PR96291.patch + 34_all_fundecl-I
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: 0d98cab225ecb321bc18d894951bb2d3b7b45bd0 Author: Sergei Trofimovich gentoo org> AuthorDate: Mon Aug 17 21:26:01 2020 + Commit: Sergei Trofimovich gentoo org> CommitDate: Mon Aug 17 21:26:01 2020 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=0d98cab2 10.2.0: backport ipa-cp bit fix, part 2 (PR/96482) Reported-by: Johannes Hirte Bug: https://bugs.gentoo.org/736685 Bug: https://gcc.gnu.org/PR96482 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/36_all_ipa-fix-bit-CP-p2.patch | 80 10.2.0/gentoo/README.history | 1 + 2 files changed, 81 insertions(+) diff --git a/10.2.0/gentoo/36_all_ipa-fix-bit-CP-p2.patch b/10.2.0/gentoo/36_all_ipa-fix-bit-CP-p2.patch new file mode 100644 index 000..1183b57 --- /dev/null +++ b/10.2.0/gentoo/36_all_ipa-fix-bit-CP-p2.patch @@ -0,0 +1,80 @@ +https://bugs.gentoo.org/736685 +https://gcc.gnu.org/PR96482 + +From 4a2371497e9bed64aa4f46169127f3ea8e32e726 Mon Sep 17 00:00:00 2001 +From: Martin Liska +Date: Thu, 13 Aug 2020 09:38:41 +0200 +Subject: [PATCH] ipa: fix ICE in get_default_value + +The patch aligns code with ipcp_bits_lattice::set_to_constant +where we properly mask m_value with m_mask. The same should +be done here. + +gcc/ChangeLog: + + PR ipa/96482 + * ipa-cp.c (ipcp_bits_lattice::meet_with_1): Mask m_value + with m_mask. + +gcc/testsuite/ChangeLog: + + PR ipa/96482 + * gcc.dg/ipa/pr96482-2.c: New test. + +(cherry picked from commit f91770216eade83f068528c1e4f00e2ac3b23044) +--- + gcc/ipa-cp.c | 2 +- + gcc/testsuite/gcc.dg/ipa/pr96482-2.c | 33 + 2 files changed, 34 insertions(+), 1 deletion(-) + create mode 100644 gcc/testsuite/gcc.dg/ipa/pr96482-2.c + +--- a/gcc/ipa-cp.c b/gcc/ipa-cp.c +@@ -1047,7 +1047,7 @@ ipcp_bits_lattice::meet_with_1 (widest_int value, widest_int mask, + + widest_int old_mask = m_mask; + m_mask = (m_mask | mask) | (m_value ^ value); +- m_value &= value; ++ m_value &= ~m_mask; + + if (wi::sext (m_mask, precision) == -1) + return set_to_bottom (); +--- /dev/null b/gcc/testsuite/gcc.dg/ipa/pr96482-2.c +@@ -0,0 +1,33 @@ ++/* PR ipa/96482 */ ++/* { dg-do compile } */ ++/* { dg-options "-O2" } */ ++ ++int i2c_transfer(); ++void _dev_err(); ++ ++struct i2c_msg { ++ char bufaddr; ++ int adapterdev; ++} wdt87xx_i2c_xfer_client; ++ ++int wdt87xx_i2c_xfer_client_0, wdt87xx_i2c_xfer_rxdata, wdt87xx_get_string_str_idx; ++ ++void ++static wdt87xx_i2c_xfer(void *txdata, unsigned rxlen) { ++ struct i2c_msg msgs[] = {wdt87xx_i2c_xfer_client_0, rxlen, ++ wdt87xx_i2c_xfer_rxdata}; ++ int error = i2c_transfer(wdt87xx_i2c_xfer_client, msgs); ++ _dev_err("", __func__, error); ++} ++static void wdt87xx_get_string(unsigned len) { ++ char tx_buf[] = {wdt87xx_get_string_str_idx, 3}; ++ int rx_len = len + 2; ++ wdt87xx_i2c_xfer(tx_buf, rx_len); ++} ++ ++void ++wdt87xx_ts_probe_tx_buf() { ++ wdt87xx_get_string(34); ++ wdt87xx_get_string(8); ++ wdt87xx_i2c_xfer(wdt87xx_ts_probe_tx_buf, 2); ++} +-- +2.28.0 + diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index 49edda3..8be215b 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -2,6 +2,7 @@ + 33_all_lto-O0-mix-ICE-ipa-PR96291.patch + 34_all_fundecl-ICE-PR95820.patch + 35_all_ipa-fix-bit-CP.patch + + 36_all_ipa-fix-bit-CP-p2.patch 1 23 July 2020 + 01_all_default-fortify-source.patch
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: 7bf989ed8b53a13de6a6551b7f346b1dcadf5966 Author: Sergei Trofimovich gentoo org> AuthorDate: Fri Oct 2 09:12:10 2020 + Commit: Sergei Trofimovich gentoo org> CommitDate: Fri Oct 2 09:12:10 2020 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=7bf989ed 10.2.0: fix multiple speculation resolution on prog builds Reported-by: Ștefan Talpalaru Bug: https://gcc.gnu.org/PR96394 Bug: https://bugs.gentoo.org/734006 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/39_all_ipa-prop-multispec.patch | 150 ++ 10.2.0/gentoo/README.history | 1 + 2 files changed, 151 insertions(+) diff --git a/10.2.0/gentoo/39_all_ipa-prop-multispec.patch b/10.2.0/gentoo/39_all_ipa-prop-multispec.patch new file mode 100644 index 000..6e19992 --- /dev/null +++ b/10.2.0/gentoo/39_all_ipa-prop-multispec.patch @@ -0,0 +1,150 @@ +https://gcc.gnu.org/PR96394 +https://bugs.gentoo.org/734006 + +From 7f790f414ec38581b9bb033ab64e4ad12b9f8a4c Mon Sep 17 00:00:00 2001 +From: Martin Jambor +Date: Thu, 1 Oct 2020 19:39:27 +0200 +Subject: [PATCH] ipa-prop: Fix multiple-target speculation resolution + +Hi, + +as the FIXME which this patch removes states, the current code does +not work when a call with multiple speculative targets gets resolved +through parameter tracking during inlining - it feeds the inliner an +edge it has already dealt with. The patch makes the code which should +prevent it aware of the possibility that that speculation can have +more than one target now. + +Bootstrapped and tested and LTO bootstrapped on x86_64-linux. I did not +try profiled LTO bootstrap because it fails even without the patch (even +without Ada, just C, C++ and Fortran, at least commit 92f0d3d03a7 does). +OK for trunk? + +Thanks, + +Martin + +gcc/ChangeLog: + +2020-09-30 Martin Jambor + + PR ipa/96394 + * ipa-prop.c (update_indirect_edges_after_inlining): Do not add + resolved speculation edges to vector of new direct edges even in + presence of multiple speculative direct edges for a single call. + +gcc/testsuite/ChangeLog: + +2020-09-30 Martin Jambor + + PR ipa/96394 + * gcc.dg/tree-prof/pr96394.c: New test. +--- + gcc/ipa-prop.c | 10 ++-- + gcc/testsuite/gcc.dg/tree-prof/pr96394.c | 64 + 2 files changed, 70 insertions(+), 4 deletions(-) + create mode 100644 gcc/testsuite/gcc.dg/tree-prof/pr96394.c + +diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c +index ea88fd3fd95..0ff04d344e1 100644 +--- a/gcc/ipa-prop.c b/gcc/ipa-prop.c +@@ -3787,11 +3787,13 @@ update_indirect_edges_after_inlining (struct cgraph_edge *cs, + + param_index = ici->param_index; + jfunc = ipa_get_ith_jump_func (top, param_index); +- cgraph_node *spec_target = NULL; + +- /* FIXME: This may need updating for multiple calls. */ ++ auto_vec spec_targets; + if (ie->speculative) +- spec_target = ie->first_speculative_call_target ()->callee; ++ for (cgraph_edge *direct = ie->first_speculative_call_target (); ++ direct; ++ direct = direct->next_speculative_call_target ()) ++spec_targets.safe_push (direct->callee); + + if (!opt_for_fn (node->decl, flag_indirect_inlining)) + new_direct_edge = NULL; +@@ -3814,7 +3816,7 @@ update_indirect_edges_after_inlining (struct cgraph_edge *cs, + + /* If speculation was removed, then we need to do nothing. */ + if (new_direct_edge && new_direct_edge != ie +-&& new_direct_edge->callee == spec_target) ++&& spec_targets.contains (new_direct_edge->callee)) + { + new_direct_edge->indirect_inlining_edge = 1; + top = IPA_EDGE_REF (cs); +diff --git a/gcc/testsuite/gcc.dg/tree-prof/pr96394.c b/gcc/testsuite/gcc.dg/tree-prof/pr96394.c +new file mode 100644 +index 000..4280182a7c3 +--- /dev/null b/gcc/testsuite/gcc.dg/tree-prof/pr96394.c +@@ -0,0 +1,64 @@ ++/* PR ipa/96394 */ ++/* { dg-options "-O2" } */ ++ ++typedef struct _entry { ++int has_next; ++int next_ix; ++int count; ++} entry; ++ ++extern entry table[]; ++ ++void * ++__attribute__((noipa)) ++PyErr_Format(entry * e){ return 0; } ++ ++void ae(entry *); ++int h(entry *); ++int ap(entry *); ++int ag(entry *); ++ ++int ag(entry *j) { ++ if (j->has_next) ++h(&table[j->next_ix]); ++ return 0; ++} ++static int ai(entry *j, int k(entry *), int l, int m) { ++ int am = 1; ++ int ab; ++ ++ /* k is either 'h' or 'ap': 50%/50% */ ++ ab = k(j); ++ ++ /* loop never gets executed on real data */ ++ for (; j->count >= 2; am += 2) ++if (l) { ++ entry *i = &table[am + m]; ++ PyErr_Format(i); ++} ++ return ab; ++} ++void ++__attribute__((noipa)) ++bug() { ++ h(table); ++ h(table); ++} ++int h(entry *j) { return ai(j, ap, 4, 5); } ++int ap(entry *j) { return ai(j, ag, 14, 4); } ++ ++int main(void) ++{ ++bug(); ++} ++ ++entry
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: b4972ce62b04aafc6061836a92f0cebbadd80d7a Author: Sergei Trofimovich gentoo org> AuthorDate: Fri Oct 2 09:22:40 2020 + Commit: Sergei Trofimovich gentoo org> CommitDate: Fri Oct 2 09:22:40 2020 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=b4972ce6 10.2.0: cut 3 patchset three new patches: + 37_all_c-vector-init-PR96377.patch: fix vector init on arm + 38_all_gcov-TOPN-PR96913.patch: fix TOPN prof counters in shared libraries + 39_all_ipa-prop-multispec.patch: fix multiple speculation resolution on prof builds Bug: https://gcc.gnu.org/PR96377 Bug: https://gcc.gnu.org/PR96913 Bug: https://bugs.gentoo.org/734006 Bug: https://gcc.gnu.org/PR96394 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/README.history | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index 5929aae..86f3aae 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -1,4 +1,4 @@ -3 TODO +3 02 Oct 2020 U 28_all_EXTRA_OPTIONS-fstack-clash-protection.patch + 37_all_c-vector-init-PR96377.patch + 38_all_gcov-TOPN-PR96913.patch
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: 9bba1f72a9210743fddf664b716b5cf288132922 Author: Sergei Trofimovich gentoo org> AuthorDate: Sun Aug 23 09:11:31 2020 + Commit: Sergei Trofimovich gentoo org> CommitDate: Sun Aug 23 09:11:31 2020 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=9bba1f72 10.2.0: cut 2 patchset Four new patches: + 33_all_lto-O0-mix-ICE-ipa-PR96291.patch: fix -O0 crash for ipa/lto + 34_all_fundecl-ICE-PR95820.patch: fix ICE on invalid templates + 35_all_ipa-fix-bit-CP.patch: fix bad code generation in ipa bit constprop + 36_all_ipa-fix-bit-CP-p2.patch: part 2 of previous patch Bug: https://bugs.gentoo.org/733482 Bug: https://gcc.gnu.org/PR96291 Bug: https://bugs.gentoo.org/730406 Bug: https://gcc.gnu.org/PR95820 Bug: https://bugs.gentoo.org/736685 Bug: https://gcc.gnu.org/PR96482 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/README.history | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index 8be215b..1bfe565 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -1,4 +1,4 @@ -2 TODO +2 23 Aug 2020 + 33_all_lto-O0-mix-ICE-ipa-PR96291.patch + 34_all_fundecl-ICE-PR95820.patch + 35_all_ipa-fix-bit-CP.patch
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: 064908a8c0b537e980721c7996d276e1901924db Author: Sergei Trofimovich gentoo org> AuthorDate: Thu Jul 23 08:15:06 2020 + Commit: Sergei Trofimovich gentoo org> CommitDate: Thu Jul 23 08:15:06 2020 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=064908a8 10.2.0: cut 1 patchset Based on gcc-10.1.0 patchset. The only change is upstreamed backportes: - 29_all_fix-float-hang-PR95118.patch - 31_all_ctor-range-PR95241.patch - 33_all_avx512-scalar-PR95528.patch - 34_all_cet-cross-x86.patch - 35_all_ICE-array-subscript-PR95508.patch - 38_all_ICE-ipa-fnsummary-PR96130.patch Bug: https://gcc.gnu.org/PR96190 Bug: https://bugs.gentoo.org/619706 Bug: https://gcc.gnu.org/PR96130 Bug: https://bugs.gentoo.org/733246 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/01_all_default-fortify-source.patch | 22 .../02_all_default-warn-format-security.patch | 22 .../gentoo/03_all_default-warn-trampolines.patch | 13 ++ 10.2.0/gentoo/04_all_nossp-on-nostdlib.patch | 27 10.2.0/gentoo/05_all_alpha-mieee-default.patch | 39 ++ 10.2.0/gentoo/06_all_ia64_note.GNU-stack.patch | 92 + .../gentoo/07_all_i386_libgcc_note.GNU-stack.patch | 54 10.2.0/gentoo/08_all_libiberty-asprintf.patch | 18 +++ 10.2.0/gentoo/09_all_libiberty-pic.patch | 10 ++ 10.2.0/gentoo/10_all_nopie-all-flags.patch | 18 +++ 10.2.0/gentoo/11_all_sh-drop-sysroot-suffix.patch | 32 + 10.2.0/gentoo/12_all_ia64-TEXTREL.patch| 22 .../gentoo/13_all_disable-systemtap-switch.patch | 122 ++ 10.2.0/gentoo/14_all_m68k-textrel-on-libgcc.patch | 93 ++ 10.2.0/gentoo/15_all_respect-build-cxxflags.patch | 39 ++ 10.2.0/gentoo/16_all_libgfortran-Werror.patch | 20 +++ 10.2.0/gentoo/17_all_libgomp-Werror.patch | 20 +++ 10.2.0/gentoo/18_all_libitm-Werror.patch | 19 +++ 10.2.0/gentoo/19_all_libatomic-Werror.patch| 19 +++ 10.2.0/gentoo/20_all_libbacktrace-Werror.patch | 17 +++ 10.2.0/gentoo/21_all_libsanitizer-Werror.patch | 17 +++ 10.2.0/gentoo/22_all_libstdcxx-no-vtv.patch| 61 + 10.2.0/gentoo/23_all_disable-riscv32-ABIs.patch| 53 10.2.0/gentoo/24_all_default_ssp-buffer-size.patch | 14 ++ 10.2.0/gentoo/25_all_hppa-faster-synth_mult.patch | 44 +++ 10.2.0/gentoo/26_all_libcpp-ar.patch | 143 + 10.2.0/gentoo/27_all_EXTRA_OPTIONS-z-now.patch | 26 ...all_EXTRA_OPTIONS-fstack-clash-protection.patch | 65 ++ .../29_all_lto-intl-workaround-PR95194.patch | 20 +++ 10.2.0/gentoo/30_all_plugin-objdump.patch | 34 + 10.2.0/gentoo/31_all_fno-delayed-branch.patch | 40 ++ 10.2.0/gentoo/32_all_sparc_pie_TEXTREL.patch | 49 +++ 10.2.0/gentoo/README.history | 33 + 33 files changed, 1317 insertions(+) diff --git a/10.2.0/gentoo/01_all_default-fortify-source.patch b/10.2.0/gentoo/01_all_default-fortify-source.patch new file mode 100644 index 000..d307474 --- /dev/null +++ b/10.2.0/gentoo/01_all_default-fortify-source.patch @@ -0,0 +1,22 @@ +Taken Debian's patch and removed docs matches: +https://salsa.debian.org/toolchain-team/gcc.git +Also see https://bugs.gentoo.org/621036 where +initially Gentoo used too complicated macro. + +# DP: Turn on -D_FORTIFY_SOURCE=2 by default for C, C++, ObjC, ObjC++, +# DP: if the optimization level is > 0 +--- a/gcc/c-family/c-cppbuiltin.c b/gcc/c-family/c-cppbuiltin.c +@@ -951,6 +951,12 @@ c_cpp_builtins (cpp_reader *pfile) + builtin_define_with_value ("__REGISTER_PREFIX__", REGISTER_PREFIX, 0); + builtin_define_with_value ("__USER_LABEL_PREFIX__", user_label_prefix, 0); + ++#if !defined(ACCEL_COMPILER) ++ /* Fortify Source enabled by default for optimization levels > 0 */ ++ if (optimize) ++builtin_define_with_int_value ("_FORTIFY_SOURCE", 2); ++#endif ++ + /* Misc. */ + if (flag_gnu89_inline) + cpp_define (pfile, "__GNUC_GNU_INLINE__"); diff --git a/10.2.0/gentoo/02_all_default-warn-format-security.patch b/10.2.0/gentoo/02_all_default-warn-format-security.patch new file mode 100644 index 000..f809abd --- /dev/null +++ b/10.2.0/gentoo/02_all_default-warn-format-security.patch @@ -0,0 +1,22 @@ +Enable -Wformat and -Wformat-security by default. + +--- a/gcc/c-family/c.opt 2016-03-23 18:51:56.0 +0100 b/gcc/c-family/c.opt 2016-04-28 23:45:54.063351272 +0200 +@@ -459,7 +459,7 @@ C ObjC C++ ObjC++ Var(warn_format_nonlit + Warn about format strings that are not literals. + + Wformat-security +-C ObjC C++ ObjC++ Var(warn_format_security) Warning LangEnabledBy(C ObjC C++ ObjC++,Wformat=, warn_format >= 2, 0) ++C ObjC C++ ObjC++ Var(warn_format_security) Init(1) Warning LangEnabledBy(C ObjC C++ ObjC++,Wformat=, warn_format >= 2, 0) + Warn about possible security problems
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: 8f9b6cda0cd772b5155d52a5effabd04fd656a18 Author: Sergei Trofimovich gentoo org> AuthorDate: Sun Jul 26 10:34:45 2020 + Commit: Sergei Trofimovich gentoo org> CommitDate: Sun Jul 26 10:34:45 2020 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=8f9b6cda 10.2.0: fix IPA ICE on LTO -O0/-O2 mix Bug: https://bugs.gentoo.org/733482 Bug: https://gcc.gnu.org/PR96291 Signed-off-by: Sergei Trofimovich gentoo.org> .../gentoo/33_all_lto-O0-mix-ICE-ipa-PR96291.patch | 46 ++ 10.2.0/gentoo/README.history | 3 ++ 2 files changed, 49 insertions(+) diff --git a/10.2.0/gentoo/33_all_lto-O0-mix-ICE-ipa-PR96291.patch b/10.2.0/gentoo/33_all_lto-O0-mix-ICE-ipa-PR96291.patch new file mode 100644 index 000..b163721 --- /dev/null +++ b/10.2.0/gentoo/33_all_lto-O0-mix-ICE-ipa-PR96291.patch @@ -0,0 +1,46 @@ +https://bugs.gentoo.org/733482 +https://gcc.gnu.org/PR96291 + +From 03810b1b2dec00575b2bcb579eb3d7c34bd176bc Mon Sep 17 00:00:00 2001 +From: Sergei Trofimovich +Date: Sat, 25 Jul 2020 19:26:50 +0100 +Subject: [PATCH] ipa/96291: don't crash on unoptimized lto functions + +In PR ipa/96291 the test contained an SCC with one +unoptimized function. This tricked ipa-cp into NULL dereference. + +has_undead_caller_from_outside_scc_p() did not take into account +that unoptimized funtions don't have IPA summary analysis. and +dereferenced NULL pointer causing an ICE. + + PR ipa/96291 + * ipa-cp.c (has_undead_caller_from_outside_scc_p): Consider + unoptimized callers as undead. +--- + gcc/ipa-cp.c | 12 +--- + 1 file changed, 9 insertions(+), 3 deletions(-) + +--- a/gcc/ipa-cp.c b/gcc/ipa-cp.c +@@ -5666,9 +5666,15 @@ has_undead_caller_from_outside_scc_p (struct cgraph_node *node, + && cs->caller->call_for_symbol_thunks_and_aliases + (has_undead_caller_from_outside_scc_p, NULL, true)) + return true; +-else if (!ipa_edge_within_scc (cs) +- && !IPA_NODE_REF (cs->caller)->node_dead) +- return true; ++else if (!ipa_edge_within_scc (cs)) ++ { ++ /* Unoptimized callers don't have IPA information. ++ Conservatively assume callers are undead. */ ++ if (!IPA_NODE_REF (cs->caller)) ++return true; ++ if (!IPA_NODE_REF (cs->caller)->node_dead) ++return true; ++ } + return false; + } + +-- +2.27.0 + diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index 4009f39..1c0fff9 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -1,3 +1,6 @@ +2 TODO + + 33_all_lto-O0-mix-ICE-ipa-PR96291.patch + 1 23 July 2020 + 01_all_default-fortify-source.patch + 02_all_default-warn-format-security.patch
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: fafbb4148cb5c2cf7e1ae02679240cba43e95992 Author: Sergei Trofimovich gentoo org> AuthorDate: Mon Jul 27 06:48:54 2020 + Commit: Sergei Trofimovich gentoo org> CommitDate: Mon Jul 27 06:48:54 2020 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=fafbb414 10.2.0: backport ICE on invalid function declarations Reported-by: Jack Ostroff Bug: https://bugs.gentoo.org/730406 Bug: https://gcc.gnu.org/PR95820 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/34_all_fundecl-ICE-PR95820.patch | 25 + 10.2.0/gentoo/README.history | 1 + 2 files changed, 26 insertions(+) diff --git a/10.2.0/gentoo/34_all_fundecl-ICE-PR95820.patch b/10.2.0/gentoo/34_all_fundecl-ICE-PR95820.patch new file mode 100644 index 000..e365420 --- /dev/null +++ b/10.2.0/gentoo/34_all_fundecl-ICE-PR95820.patch @@ -0,0 +1,25 @@ +It's an unofficial backport of PR95820 where gcc ICEs on +invalid syntax. As creduce frequently end up in these ICEs +as in #730406 let's backport it to gcc-10. + +https://gcc.gnu.org/PR95820 +https://bugs.gentoo.org/730406 +--- a/gcc/cp/decl.c b/gcc/cp/decl.c +@@ -12029,14 +12029,11 @@ grokdeclarator (const cp_declarator *declarator, + + /* Handle a late-specified return type. */ + tree late_return_type = declarator->u.function.late_return_type; +- if (funcdecl_p +- /* This is the case e.g. for +- using T = auto () -> int. */ +- || inner_declarator == NULL) ++ if (true) + { + if (tree auto_node = type_uses_auto (type)) + { +- if (!late_return_type) ++ if (!late_return_type && funcdecl_p) + { + if (current_class_type + && LAMBDA_TYPE_P (current_class_type)) diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index 1c0fff9..7cde6a3 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -1,5 +1,6 @@ 2 TODO + 33_all_lto-O0-mix-ICE-ipa-PR96291.patch + + 34_all_fundecl-ICE-PR95820.patch 1 23 July 2020 + 01_all_default-fortify-source.patch
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: bb00f570a7d3f1d0e4233f8d353fb9c56f3a55cc Author: Sergei Trofimovich gentoo org> AuthorDate: Thu Sep 10 21:37:36 2020 + Commit: Sergei Trofimovich gentoo org> CommitDate: Thu Sep 10 21:37:36 2020 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=bb00f570 10.2.0: fix TOPN counters when logged from shared library The change does not yet fix underlying problem of recursive inliner. Bug: https://gcc.gnu.org/PR96913 Bug: https://gcc.gnu.org/PR96394 Bug: https://bugs.gentoo.org/734006 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/38_all_gcov-TOPN-PR96913.patch | 42 10.2.0/gentoo/README.history | 1 + 2 files changed, 43 insertions(+) diff --git a/10.2.0/gentoo/38_all_gcov-TOPN-PR96913.patch b/10.2.0/gentoo/38_all_gcov-TOPN-PR96913.patch new file mode 100644 index 000..5c301e4 --- /dev/null +++ b/10.2.0/gentoo/38_all_gcov-TOPN-PR96913.patch @@ -0,0 +1,42 @@ +https://gcc.gnu.org/PR96913 +https://gcc.gnu.org/PR96394 +https://bugs.gentoo.org/734006 + +From ae887148e112e018bec0bab5bc15e53f2225037a Mon Sep 17 00:00:00 2001 +From: Sergei Trofimovich +Date: Sun, 6 Sep 2020 12:13:54 +0100 +Subject: [PATCH] gcov: fix TOPN streaming from shared libraries + +Before the change gcc did not stream correctly TOPN counters +if counters belonged to a non-local shared object. + +As a result zero-section optimization generated TOPN sections +in a form not recognizable by '__gcov_merge_topn'. + +The problem happens because in a case of multiple shared objects +'__gcov_merge_topn' function is present in address space multiple +times (once per each object). + +The fix is to never rely on function address and predicate on TOPN +counter types. + +libgcc/ChangeLog: + + PR gcov-profile/96913 + * libgcov-driver.c (write_one_data): Avoid function pointer + comparison in TOP streaming decision. +--- + libgcc/libgcov-driver.c | 7 ++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +--- a/libgcc/libgcov-driver.c b/libgcc/libgcov-driver.c +@@ -242,7 +242,7 @@ prune_counters (struct gcov_info *gi) + if (gi->merge[j] == NULL) + continue; + +-if (gi->merge[j] == __gcov_merge_topn) ++if (j == GCOV_COUNTER_V_TOPN || j == GCOV_COUNTER_V_INDIR) + { + gcc_assert (!(ci->num % GCOV_TOPN_VALUES_COUNTERS)); + for (unsigned k = 0; k < (ci->num / GCOV_TOPN_VALUES_COUNTERS); diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index 3fbcbfd..6d00c5a 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -1,6 +1,7 @@ 3 TODO U 28_all_EXTRA_OPTIONS-fstack-clash-protection.patch + 37_all_c-vector-init-PR96377.patch + + 38_all_gcov-TOPN-PR96913.patch 2 23 Aug 2020 + 33_all_lto-O0-mix-ICE-ipa-PR96291.patch
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: 064908a8c0b537e980721c7996d276e1901924db Author: Sergei Trofimovich gentoo org> AuthorDate: Thu Jul 23 08:15:06 2020 + Commit: Sergei Trofimovich gentoo org> CommitDate: Thu Jul 23 08:15:06 2020 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=064908a8 10.2.0: cut 1 patchset Based on gcc-10.1.0 patchset. The only change is upstreamed backportes: - 29_all_fix-float-hang-PR95118.patch - 31_all_ctor-range-PR95241.patch - 33_all_avx512-scalar-PR95528.patch - 34_all_cet-cross-x86.patch - 35_all_ICE-array-subscript-PR95508.patch - 38_all_ICE-ipa-fnsummary-PR96130.patch Bug: https://gcc.gnu.org/PR96190 Bug: https://bugs.gentoo.org/619706 Bug: https://gcc.gnu.org/PR96130 Bug: https://bugs.gentoo.org/733246 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/01_all_default-fortify-source.patch | 22 .../02_all_default-warn-format-security.patch | 22 .../gentoo/03_all_default-warn-trampolines.patch | 13 ++ 10.2.0/gentoo/04_all_nossp-on-nostdlib.patch | 27 10.2.0/gentoo/05_all_alpha-mieee-default.patch | 39 ++ 10.2.0/gentoo/06_all_ia64_note.GNU-stack.patch | 92 + .../gentoo/07_all_i386_libgcc_note.GNU-stack.patch | 54 10.2.0/gentoo/08_all_libiberty-asprintf.patch | 18 +++ 10.2.0/gentoo/09_all_libiberty-pic.patch | 10 ++ 10.2.0/gentoo/10_all_nopie-all-flags.patch | 18 +++ 10.2.0/gentoo/11_all_sh-drop-sysroot-suffix.patch | 32 + 10.2.0/gentoo/12_all_ia64-TEXTREL.patch| 22 .../gentoo/13_all_disable-systemtap-switch.patch | 122 ++ 10.2.0/gentoo/14_all_m68k-textrel-on-libgcc.patch | 93 ++ 10.2.0/gentoo/15_all_respect-build-cxxflags.patch | 39 ++ 10.2.0/gentoo/16_all_libgfortran-Werror.patch | 20 +++ 10.2.0/gentoo/17_all_libgomp-Werror.patch | 20 +++ 10.2.0/gentoo/18_all_libitm-Werror.patch | 19 +++ 10.2.0/gentoo/19_all_libatomic-Werror.patch| 19 +++ 10.2.0/gentoo/20_all_libbacktrace-Werror.patch | 17 +++ 10.2.0/gentoo/21_all_libsanitizer-Werror.patch | 17 +++ 10.2.0/gentoo/22_all_libstdcxx-no-vtv.patch| 61 + 10.2.0/gentoo/23_all_disable-riscv32-ABIs.patch| 53 10.2.0/gentoo/24_all_default_ssp-buffer-size.patch | 14 ++ 10.2.0/gentoo/25_all_hppa-faster-synth_mult.patch | 44 +++ 10.2.0/gentoo/26_all_libcpp-ar.patch | 143 + 10.2.0/gentoo/27_all_EXTRA_OPTIONS-z-now.patch | 26 ...all_EXTRA_OPTIONS-fstack-clash-protection.patch | 65 ++ .../29_all_lto-intl-workaround-PR95194.patch | 20 +++ 10.2.0/gentoo/30_all_plugin-objdump.patch | 34 + 10.2.0/gentoo/31_all_fno-delayed-branch.patch | 40 ++ 10.2.0/gentoo/32_all_sparc_pie_TEXTREL.patch | 49 +++ 10.2.0/gentoo/README.history | 33 + 33 files changed, 1317 insertions(+) diff --git a/10.2.0/gentoo/01_all_default-fortify-source.patch b/10.2.0/gentoo/01_all_default-fortify-source.patch new file mode 100644 index 000..d307474 --- /dev/null +++ b/10.2.0/gentoo/01_all_default-fortify-source.patch @@ -0,0 +1,22 @@ +Taken Debian's patch and removed docs matches: +https://salsa.debian.org/toolchain-team/gcc.git +Also see https://bugs.gentoo.org/621036 where +initially Gentoo used too complicated macro. + +# DP: Turn on -D_FORTIFY_SOURCE=2 by default for C, C++, ObjC, ObjC++, +# DP: if the optimization level is > 0 +--- a/gcc/c-family/c-cppbuiltin.c b/gcc/c-family/c-cppbuiltin.c +@@ -951,6 +951,12 @@ c_cpp_builtins (cpp_reader *pfile) + builtin_define_with_value ("__REGISTER_PREFIX__", REGISTER_PREFIX, 0); + builtin_define_with_value ("__USER_LABEL_PREFIX__", user_label_prefix, 0); + ++#if !defined(ACCEL_COMPILER) ++ /* Fortify Source enabled by default for optimization levels > 0 */ ++ if (optimize) ++builtin_define_with_int_value ("_FORTIFY_SOURCE", 2); ++#endif ++ + /* Misc. */ + if (flag_gnu89_inline) + cpp_define (pfile, "__GNUC_GNU_INLINE__"); diff --git a/10.2.0/gentoo/02_all_default-warn-format-security.patch b/10.2.0/gentoo/02_all_default-warn-format-security.patch new file mode 100644 index 000..f809abd --- /dev/null +++ b/10.2.0/gentoo/02_all_default-warn-format-security.patch @@ -0,0 +1,22 @@ +Enable -Wformat and -Wformat-security by default. + +--- a/gcc/c-family/c.opt 2016-03-23 18:51:56.0 +0100 b/gcc/c-family/c.opt 2016-04-28 23:45:54.063351272 +0200 +@@ -459,7 +459,7 @@ C ObjC C++ ObjC++ Var(warn_format_nonlit + Warn about format strings that are not literals. + + Wformat-security +-C ObjC C++ ObjC++ Var(warn_format_security) Warning LangEnabledBy(C ObjC C++ ObjC++,Wformat=, warn_format >= 2, 0) ++C ObjC C++ ObjC++ Var(warn_format_security) Init(1) Warning LangEnabledBy(C ObjC C++ ObjC++,Wformat=, warn_format >= 2, 0) + Warn about possible security problems
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: 8f9b6cda0cd772b5155d52a5effabd04fd656a18 Author: Sergei Trofimovich gentoo org> AuthorDate: Sun Jul 26 10:34:45 2020 + Commit: Sergei Trofimovich gentoo org> CommitDate: Sun Jul 26 10:34:45 2020 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=8f9b6cda 10.2.0: fix IPA ICE on LTO -O0/-O2 mix Bug: https://bugs.gentoo.org/733482 Bug: https://gcc.gnu.org/PR96291 Signed-off-by: Sergei Trofimovich gentoo.org> .../gentoo/33_all_lto-O0-mix-ICE-ipa-PR96291.patch | 46 ++ 10.2.0/gentoo/README.history | 3 ++ 2 files changed, 49 insertions(+) diff --git a/10.2.0/gentoo/33_all_lto-O0-mix-ICE-ipa-PR96291.patch b/10.2.0/gentoo/33_all_lto-O0-mix-ICE-ipa-PR96291.patch new file mode 100644 index 000..b163721 --- /dev/null +++ b/10.2.0/gentoo/33_all_lto-O0-mix-ICE-ipa-PR96291.patch @@ -0,0 +1,46 @@ +https://bugs.gentoo.org/733482 +https://gcc.gnu.org/PR96291 + +From 03810b1b2dec00575b2bcb579eb3d7c34bd176bc Mon Sep 17 00:00:00 2001 +From: Sergei Trofimovich +Date: Sat, 25 Jul 2020 19:26:50 +0100 +Subject: [PATCH] ipa/96291: don't crash on unoptimized lto functions + +In PR ipa/96291 the test contained an SCC with one +unoptimized function. This tricked ipa-cp into NULL dereference. + +has_undead_caller_from_outside_scc_p() did not take into account +that unoptimized funtions don't have IPA summary analysis. and +dereferenced NULL pointer causing an ICE. + + PR ipa/96291 + * ipa-cp.c (has_undead_caller_from_outside_scc_p): Consider + unoptimized callers as undead. +--- + gcc/ipa-cp.c | 12 +--- + 1 file changed, 9 insertions(+), 3 deletions(-) + +--- a/gcc/ipa-cp.c b/gcc/ipa-cp.c +@@ -5666,9 +5666,15 @@ has_undead_caller_from_outside_scc_p (struct cgraph_node *node, + && cs->caller->call_for_symbol_thunks_and_aliases + (has_undead_caller_from_outside_scc_p, NULL, true)) + return true; +-else if (!ipa_edge_within_scc (cs) +- && !IPA_NODE_REF (cs->caller)->node_dead) +- return true; ++else if (!ipa_edge_within_scc (cs)) ++ { ++ /* Unoptimized callers don't have IPA information. ++ Conservatively assume callers are undead. */ ++ if (!IPA_NODE_REF (cs->caller)) ++return true; ++ if (!IPA_NODE_REF (cs->caller)->node_dead) ++return true; ++ } + return false; + } + +-- +2.27.0 + diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index 4009f39..1c0fff9 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -1,3 +1,6 @@ +2 TODO + + 33_all_lto-O0-mix-ICE-ipa-PR96291.patch + 1 23 July 2020 + 01_all_default-fortify-source.patch + 02_all_default-warn-format-security.patch
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: fafbb4148cb5c2cf7e1ae02679240cba43e95992 Author: Sergei Trofimovich gentoo org> AuthorDate: Mon Jul 27 06:48:54 2020 + Commit: Sergei Trofimovich gentoo org> CommitDate: Mon Jul 27 06:48:54 2020 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=fafbb414 10.2.0: backport ICE on invalid function declarations Reported-by: Jack Ostroff Bug: https://bugs.gentoo.org/730406 Bug: https://gcc.gnu.org/PR95820 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/34_all_fundecl-ICE-PR95820.patch | 25 + 10.2.0/gentoo/README.history | 1 + 2 files changed, 26 insertions(+) diff --git a/10.2.0/gentoo/34_all_fundecl-ICE-PR95820.patch b/10.2.0/gentoo/34_all_fundecl-ICE-PR95820.patch new file mode 100644 index 000..e365420 --- /dev/null +++ b/10.2.0/gentoo/34_all_fundecl-ICE-PR95820.patch @@ -0,0 +1,25 @@ +It's an unofficial backport of PR95820 where gcc ICEs on +invalid syntax. As creduce frequently end up in these ICEs +as in #730406 let's backport it to gcc-10. + +https://gcc.gnu.org/PR95820 +https://bugs.gentoo.org/730406 +--- a/gcc/cp/decl.c b/gcc/cp/decl.c +@@ -12029,14 +12029,11 @@ grokdeclarator (const cp_declarator *declarator, + + /* Handle a late-specified return type. */ + tree late_return_type = declarator->u.function.late_return_type; +- if (funcdecl_p +- /* This is the case e.g. for +- using T = auto () -> int. */ +- || inner_declarator == NULL) ++ if (true) + { + if (tree auto_node = type_uses_auto (type)) + { +- if (!late_return_type) ++ if (!late_return_type && funcdecl_p) + { + if (current_class_type + && LAMBDA_TYPE_P (current_class_type)) diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index 1c0fff9..7cde6a3 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -1,5 +1,6 @@ 2 TODO + 33_all_lto-O0-mix-ICE-ipa-PR96291.patch + + 34_all_fundecl-ICE-PR95820.patch 1 23 July 2020 + 01_all_default-fortify-source.patch
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: 7ecc76113ad46206cbe6e8bdc1ca39bee97be4dd Author: Sergei Trofimovich gentoo org> AuthorDate: Thu Sep 3 17:11:15 2020 + Commit: Sergei Trofimovich gentoo org> CommitDate: Thu Sep 3 17:11:15 2020 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=7ecc7611 10.2.0: backport PR96377 (c vector init syntax) Bug: https://gcc.gnu.org/PR96377 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/37_all_c-vector-init-PR96377.patch | 522 +++ 10.2.0/gentoo/README.history | 1 + 2 files changed, 523 insertions(+) diff --git a/10.2.0/gentoo/37_all_c-vector-init-PR96377.patch b/10.2.0/gentoo/37_all_c-vector-init-PR96377.patch new file mode 100644 index 000..7ef9cdd --- /dev/null +++ b/10.2.0/gentoo/37_all_c-vector-init-PR96377.patch @@ -0,0 +1,522 @@ +https://gcc.gnu.org/PR96377 + +From a216daaa30bc8949086a16e7656f2025b692d03c Mon Sep 17 00:00:00 2001 +From: Richard Sandiford +Date: Mon, 3 Aug 2020 09:48:36 +0100 +Subject: [PATCH] c: Fix bogus vector initialisation error [PR96377] + +One of the problems in this PR was that if we had: + + vector_type1 array[] = { vector_value1 }; + +process_init_element would only treat vector_value1 as initialising +a vector_type1 if they had the same TYPE_MAIN_VARIANT. This has +several problems: + +(1) It gives confusing error messages if the vector types are +incompatible. (Tested by gcc.dg/pr96377-1.c.) + +(2) It means that we reject code that should be valid with +-flax-vector-conversions. (Tested by gcc.dg/pr96377-2.c.) + +(3) On arm and aarch64 targets, it means that we reject some +initializers that mix Advanced SIMD and standard GNU vectors. +These vectors have traditionally had different TYPE_MAIN_VARIANTs +because they have different mangling schemes. (Tested by +gcc.dg/pr96377-[3-6].c.) + +(4) It means that we reject SVE initializers that should be valid. +(Tested by gcc.target/aarch64/sve/gnu_vectors_[34].c.) + +(5) After r11-1741-g:31427b974ed7b7dd54e2 we reject: + + arm_neon_type1 array[] = { k ^ arm_neon_value1 }; + +because applying the binary operator to arm_neon_value1 strips +the "Advanced SIMD type" attributes that were added in that patch. +Stripping the attributes is problematic for other reasons though, +so that still needs to be fixed separately. + +g++.target/aarch64/sve/gnu_vectors_[34].C already pass. + +gcc/c/ + PR c/96377 + * c-typeck.c (process_init_element): Split test for whether to + recurse into a record, union or array into... + (initialize_elementwise_p): ...this new function. Don't recurse + into a vector type if the initialization value is also a vector. + +gcc/testsuite/ + PR c/96377 + * gcc.dg/pr96377-1.c: New test. + * gcc.dg/pr96377-2.c: Likewise. + * gcc.dg/pr96377-3.c: Likewise. + * gcc.dg/pr96377-4.c: Likewise. + * gcc.dg/pr96377-5.c: Likewise. + * gcc.dg/pr96377-6.c: Likewise. + * gcc.target/aarch64/pr96377-1.c: Likewise. + * gcc.target/aarch64/sve/acle/general-c/gnu_vectors_3.c: Likewise. + * gcc.target/aarch64/sve/acle/general-c/gnu_vectors_4.c: Likewise. + * g++.target/aarch64/sve/acle/general-c++/gnu_vectors_3.C: Likewise. + * g++.target/aarch64/sve/acle/general-c++/gnu_vectors_4.C: Likewise. + +(cherry picked from commit 7d599ad27b9bcf5165f87710f1abc64bbabd06ae) +--- + gcc/c/c-typeck.c | 59 ++- + .../sve/acle/general-c++/gnu_vectors_3.C | 15 + + .../sve/acle/general-c++/gnu_vectors_4.C | 15 + + gcc/testsuite/gcc.dg/pr96377-1.c | 32 ++ + gcc/testsuite/gcc.dg/pr96377-2.c | 31 ++ + gcc/testsuite/gcc.dg/pr96377-3.c | 33 +++ + gcc/testsuite/gcc.dg/pr96377-4.c | 32 ++ + gcc/testsuite/gcc.dg/pr96377-5.c | 33 +++ + gcc/testsuite/gcc.dg/pr96377-6.c | 32 ++ + gcc/testsuite/gcc.target/aarch64/pr96377-1.c | 20 +++ + .../sve/acle/general-c/gnu_vectors_3.c| 15 + + .../sve/acle/general-c/gnu_vectors_4.c| 15 + + 12 files changed, 317 insertions(+), 15 deletions(-) + create mode 100644 gcc/testsuite/g++.target/aarch64/sve/acle/general-c++/gnu_vectors_3.C + create mode 100644 gcc/testsuite/g++.target/aarch64/sve/acle/general-c++/gnu_vectors_4.C + create mode 100644 gcc/testsuite/gcc.dg/pr96377-1.c + create mode 100644 gcc/testsuite/gcc.dg/pr96377-2.c + create mode 100644 gcc/testsuite/gcc.dg/pr96377-3.c + create mode 100644 gcc/testsuite/gcc.dg/pr96377-4.c + create mode 100644 gcc/testsuite/gcc.dg/pr96377-5.c + create mode 100644 gcc/testsuite/gcc.dg/pr96377-6.c + create mode 100644 gcc/testsuite/gcc.target/aarch64/pr96377-1.c + create mode 100644 gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/gnu_vectors_3.c + create mode 100644 gcc/testsuite/gcc.target/aarch64/sve
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: c446f6f37e5a5f0867527acdb0b78333e3b70822 Author: Sergei Trofimovich gentoo org> AuthorDate: Thu Aug 13 08:39:49 2020 + Commit: Sergei Trofimovich gentoo org> CommitDate: Thu Aug 13 08:39:49 2020 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=c446f6f3 10.2.0:backport ipa-cp bit fix (PR/96482) Reported-by: Johannes Hirte Bug: https://bugs.gentoo.org/736685 Bug: https://gcc.gnu.org/PR96482 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/35_all_ipa-fix-bit-CP.patch | 145 ++ 10.2.0/gentoo/README.history | 1 + 2 files changed, 146 insertions(+) diff --git a/10.2.0/gentoo/35_all_ipa-fix-bit-CP.patch b/10.2.0/gentoo/35_all_ipa-fix-bit-CP.patch new file mode 100644 index 000..34a1fe0 --- /dev/null +++ b/10.2.0/gentoo/35_all_ipa-fix-bit-CP.patch @@ -0,0 +1,145 @@ +https://bugs.gentoo.org/736685 +https://gcc.gnu.org/PR96482 + +From 66780083a0e79e5cb7c3acc8665aa47be4084a67 Mon Sep 17 00:00:00 2001 +From: Martin Liska +Date: Wed, 12 Aug 2020 09:21:51 +0200 +Subject: [PATCH] ipa: fix bit CPP when combined with IPA bit CP + +As mentioned in the PR, let's consider the following example: + +int +__attribute__((noinline)) +foo(int arg) +{ + if (arg == 3) +return 1; + if (arg == 4) +return 123; + + __builtin_unreachable (); +} + +during WPA we find all calls of the function +(yes the call with value 5 is UBSAN): + + Node: foo/0: +param [0]: 5 [loc_time: 4, loc_size: 2, prop_time: 0, prop_size: 0] + 3 [loc_time: 3, loc_size: 3, prop_time: 0, prop_size: 0] + ctxs: VARIABLE + Bits: value = 0x5, mask = 0x6 + +in LTRANS we have the following VRP info: + + # RANGE [3, 3] NONZERO 3 + +when we AND masks in get_default_value we end up with 6 & 3 = 2 (0x010). +That means the only second (least significant bit) is unknown and +value (5 = 0x101) & ~mask gives us either 7 (0x111) or 5 (0x101). + +That's why if (arg_2(D) == 3) gets optimized to false. + +gcc/ChangeLog: + + PR ipa/96482 + * ipa-cp.c (ipcp_bits_lattice::meet_with_1): Drop value bits + for bits that are unknown. + (ipcp_bits_lattice::set_to_constant): Likewise. + * tree-ssa-ccp.c (get_default_value): Add sanity check that + IPA CP bit info has all bits set to zero in bits that + are unknown. + +gcc/testsuite/ChangeLog: + + PR ipa/96482 + * gcc.dg/ipa/pr96482.c: New test. + +(cherry picked from commit d58f078ce2d53e5dab6b3d0d5f960504268e1894) +--- + gcc/ipa-cp.c | 3 +- + gcc/testsuite/gcc.dg/ipa/pr96482.c | 44 ++ + gcc/tree-ssa-ccp.c | 3 ++ + 3 files changed, 49 insertions(+), 1 deletion(-) + create mode 100644 gcc/testsuite/gcc.dg/ipa/pr96482.c + +--- a/gcc/ipa-cp.c b/gcc/ipa-cp.c +@@ -1010,7 +1010,7 @@ ipcp_bits_lattice::set_to_constant (widest_int value, widest_int mask) + { + gcc_assert (top_p ()); + m_lattice_val = IPA_BITS_CONSTANT; +- m_value = value; ++ m_value = wi::bit_and (wi::bit_not (mask), value); + m_mask = mask; + return true; + } +@@ -1047,6 +1047,7 @@ ipcp_bits_lattice::meet_with_1 (widest_int value, widest_int mask, + + widest_int old_mask = m_mask; + m_mask = (m_mask | mask) | (m_value ^ value); ++ m_value &= value; + + if (wi::sext (m_mask, precision) == -1) + return set_to_bottom (); +--- /dev/null b/gcc/testsuite/gcc.dg/ipa/pr96482.c +@@ -0,0 +1,44 @@ ++/* PR ipa/96482 */ ++/* { dg-do run } */ ++/* { dg-options "-O2 -flto" } */ ++/* { dg-require-effective-target lto } */ ++ ++int ++__attribute__((noinline)) ++foo(int arg) ++{ ++ if (arg == 3) ++return 1; ++ if (arg == 4) ++return 123; ++ ++ __builtin_unreachable (); ++} ++ ++int ++__attribute__((noinline)) ++baz(int x) ++{ ++ if (x != 0) ++return foo(3); /* called */ ++ ++ return 1; ++} ++ ++int ++__attribute__((noinline)) ++bar(int x) ++{ ++ if (x == 0) ++return foo(5); /* not executed */ ++ ++ return 1; ++} ++ ++int main(int argc, char **argv) ++{ ++ if (bar(argc) != baz(argc)) ++__builtin_abort (); ++ ++ return 0; ++} +--- a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c +@@ -306,6 +306,9 @@ get_default_value (tree var) + { + val.lattice_val = CONSTANT; + val.value = value; ++widest_int ipa_value = wi::to_widest (value); ++/* Unknown bits from IPA CP must be equal to zero. */ ++gcc_assert (wi::bit_and (ipa_value, mask) == 0); + val.mask = mask; + if (nonzero_bits != -1) + val.mask &= extend_mask (nonzero_bits, +-- +2.28.0 + diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index 7cde6a3..49edda3 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -1,6 +1,7 @@ 2 TODO + 33_all_lto-O0-mix-ICE-ipa-PR96291.patch + 34_all_fundecl-I
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: 0d98cab225ecb321bc18d894951bb2d3b7b45bd0 Author: Sergei Trofimovich gentoo org> AuthorDate: Mon Aug 17 21:26:01 2020 + Commit: Sergei Trofimovich gentoo org> CommitDate: Mon Aug 17 21:26:01 2020 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=0d98cab2 10.2.0: backport ipa-cp bit fix, part 2 (PR/96482) Reported-by: Johannes Hirte Bug: https://bugs.gentoo.org/736685 Bug: https://gcc.gnu.org/PR96482 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/36_all_ipa-fix-bit-CP-p2.patch | 80 10.2.0/gentoo/README.history | 1 + 2 files changed, 81 insertions(+) diff --git a/10.2.0/gentoo/36_all_ipa-fix-bit-CP-p2.patch b/10.2.0/gentoo/36_all_ipa-fix-bit-CP-p2.patch new file mode 100644 index 000..1183b57 --- /dev/null +++ b/10.2.0/gentoo/36_all_ipa-fix-bit-CP-p2.patch @@ -0,0 +1,80 @@ +https://bugs.gentoo.org/736685 +https://gcc.gnu.org/PR96482 + +From 4a2371497e9bed64aa4f46169127f3ea8e32e726 Mon Sep 17 00:00:00 2001 +From: Martin Liska +Date: Thu, 13 Aug 2020 09:38:41 +0200 +Subject: [PATCH] ipa: fix ICE in get_default_value + +The patch aligns code with ipcp_bits_lattice::set_to_constant +where we properly mask m_value with m_mask. The same should +be done here. + +gcc/ChangeLog: + + PR ipa/96482 + * ipa-cp.c (ipcp_bits_lattice::meet_with_1): Mask m_value + with m_mask. + +gcc/testsuite/ChangeLog: + + PR ipa/96482 + * gcc.dg/ipa/pr96482-2.c: New test. + +(cherry picked from commit f91770216eade83f068528c1e4f00e2ac3b23044) +--- + gcc/ipa-cp.c | 2 +- + gcc/testsuite/gcc.dg/ipa/pr96482-2.c | 33 + 2 files changed, 34 insertions(+), 1 deletion(-) + create mode 100644 gcc/testsuite/gcc.dg/ipa/pr96482-2.c + +--- a/gcc/ipa-cp.c b/gcc/ipa-cp.c +@@ -1047,7 +1047,7 @@ ipcp_bits_lattice::meet_with_1 (widest_int value, widest_int mask, + + widest_int old_mask = m_mask; + m_mask = (m_mask | mask) | (m_value ^ value); +- m_value &= value; ++ m_value &= ~m_mask; + + if (wi::sext (m_mask, precision) == -1) + return set_to_bottom (); +--- /dev/null b/gcc/testsuite/gcc.dg/ipa/pr96482-2.c +@@ -0,0 +1,33 @@ ++/* PR ipa/96482 */ ++/* { dg-do compile } */ ++/* { dg-options "-O2" } */ ++ ++int i2c_transfer(); ++void _dev_err(); ++ ++struct i2c_msg { ++ char bufaddr; ++ int adapterdev; ++} wdt87xx_i2c_xfer_client; ++ ++int wdt87xx_i2c_xfer_client_0, wdt87xx_i2c_xfer_rxdata, wdt87xx_get_string_str_idx; ++ ++void ++static wdt87xx_i2c_xfer(void *txdata, unsigned rxlen) { ++ struct i2c_msg msgs[] = {wdt87xx_i2c_xfer_client_0, rxlen, ++ wdt87xx_i2c_xfer_rxdata}; ++ int error = i2c_transfer(wdt87xx_i2c_xfer_client, msgs); ++ _dev_err("", __func__, error); ++} ++static void wdt87xx_get_string(unsigned len) { ++ char tx_buf[] = {wdt87xx_get_string_str_idx, 3}; ++ int rx_len = len + 2; ++ wdt87xx_i2c_xfer(tx_buf, rx_len); ++} ++ ++void ++wdt87xx_ts_probe_tx_buf() { ++ wdt87xx_get_string(34); ++ wdt87xx_get_string(8); ++ wdt87xx_i2c_xfer(wdt87xx_ts_probe_tx_buf, 2); ++} +-- +2.28.0 + diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index 49edda3..8be215b 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -2,6 +2,7 @@ + 33_all_lto-O0-mix-ICE-ipa-PR96291.patch + 34_all_fundecl-ICE-PR95820.patch + 35_all_ipa-fix-bit-CP.patch + + 36_all_ipa-fix-bit-CP-p2.patch 1 23 July 2020 + 01_all_default-fortify-source.patch
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: 9bba1f72a9210743fddf664b716b5cf288132922 Author: Sergei Trofimovich gentoo org> AuthorDate: Sun Aug 23 09:11:31 2020 + Commit: Sergei Trofimovich gentoo org> CommitDate: Sun Aug 23 09:11:31 2020 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=9bba1f72 10.2.0: cut 2 patchset Four new patches: + 33_all_lto-O0-mix-ICE-ipa-PR96291.patch: fix -O0 crash for ipa/lto + 34_all_fundecl-ICE-PR95820.patch: fix ICE on invalid templates + 35_all_ipa-fix-bit-CP.patch: fix bad code generation in ipa bit constprop + 36_all_ipa-fix-bit-CP-p2.patch: part 2 of previous patch Bug: https://bugs.gentoo.org/733482 Bug: https://gcc.gnu.org/PR96291 Bug: https://bugs.gentoo.org/730406 Bug: https://gcc.gnu.org/PR95820 Bug: https://bugs.gentoo.org/736685 Bug: https://gcc.gnu.org/PR96482 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/README.history | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index 8be215b..1bfe565 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -1,4 +1,4 @@ -2 TODO +2 23 Aug 2020 + 33_all_lto-O0-mix-ICE-ipa-PR96291.patch + 34_all_fundecl-ICE-PR95820.patch + 35_all_ipa-fix-bit-CP.patch
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: d6e1bf3168cce755396a408032b4804a7a527d43 Author: Sergei Trofimovich gentoo org> AuthorDate: Wed Nov 4 00:03:31 2020 + Commit: Sergei Trofimovich gentoo org> CommitDate: Wed Nov 4 07:26:02 2020 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=d6e1bf31 10.2.0: cut 4 patchset Single new patch: + 40_all_ipa-to_frequency.patch: fix ICE on empty profile merges. Bug: https://bugs.gentoo.org/746578 Bug: https://gcc.gnu.org/PR97295 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/README.history | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index e419e62..e0207e7 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -1,4 +1,4 @@ -4 TODO +4 04 Nov 2020 + 40_all_ipa-to_frequency.patch 3 02 Oct 2020
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: 7adab39a82fd07085f600603bdc5c440aa1c142a Author: Sergei Trofimovich gentoo org> AuthorDate: Tue Dec 29 09:51:52 2020 + Commit: Sergei Trofimovich gentoo org> CommitDate: Tue Dec 29 09:51:52 2020 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=7adab39a 10.2.0: revert PR95820 backporting The backport breaks parsing as seen in https://gcc.gnu.org/PR98441 Bug: https://gcc.gnu.org/PR95820 Bug: https://bugs.gentoo.org/730406 Reported-by: Daniel Santos Bug: https://gcc.gnu.org/PR98441 Bug: https://bugs.gentoo.org/762382 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/34_all_fundecl-ICE-PR95820.patch | 25 - 10.2.0/gentoo/README.history | 3 +++ 2 files changed, 3 insertions(+), 25 deletions(-) diff --git a/10.2.0/gentoo/34_all_fundecl-ICE-PR95820.patch b/10.2.0/gentoo/34_all_fundecl-ICE-PR95820.patch deleted file mode 100644 index e365420..000 --- a/10.2.0/gentoo/34_all_fundecl-ICE-PR95820.patch +++ /dev/null @@ -1,25 +0,0 @@ -It's an unofficial backport of PR95820 where gcc ICEs on -invalid syntax. As creduce frequently end up in these ICEs -as in #730406 let's backport it to gcc-10. - -https://gcc.gnu.org/PR95820 -https://bugs.gentoo.org/730406 a/gcc/cp/decl.c -+++ b/gcc/cp/decl.c -@@ -12029,14 +12029,11 @@ grokdeclarator (const cp_declarator *declarator, - - /* Handle a late-specified return type. */ - tree late_return_type = declarator->u.function.late_return_type; -- if (funcdecl_p -- /* This is the case e.g. for -- using T = auto () -> int. */ -- || inner_declarator == NULL) -+ if (true) - { - if (tree auto_node = type_uses_auto (type)) - { -- if (!late_return_type) -+ if (!late_return_type && funcdecl_p) - { - if (current_class_type - && LAMBDA_TYPE_P (current_class_type)) diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index 639805d..81678b5 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -1,3 +1,6 @@ +6 TODO + - 34_all_fundecl-ICE-PR95820.patch + 5 18 Dec 2020 + 41_all_strlen-PR96758.patch
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: e71e59c25315ebda3ebf4014bb108db9dda08a27 Author: Sergei Trofimovich gentoo org> AuthorDate: Fri Dec 18 20:57:44 2020 + Commit: Sergei Trofimovich gentoo org> CommitDate: Fri Dec 18 20:57:44 2020 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=e71e59c2 10.2.0: cut 5 patchset Single new patch: + 41_all_strlen-PR96758.patch: fix string comparison against literals Bug: https://bugs.gentoo.org/757792 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/README.history | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index 8b8c475..639805d 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -1,4 +1,4 @@ -5 TODO +5 18 Dec 2020 + 41_all_strlen-PR96758.patch 4 04 Nov 2020
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: 3779ee05e8c035d435c62198f3b761516e63fdf0 Author: Sergei Trofimovich gentoo org> AuthorDate: Tue Dec 29 10:05:50 2020 + Commit: Sergei Trofimovich gentoo org> CommitDate: Tue Dec 29 10:05:50 2020 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=3779ee05 10.2.0: cut 6 patchset Single dropped patch: - 34_all_fundecl-ICE-PR95820.patch: revert PR95820 backporting Bug: https://gcc.gnu.org/PR95820 Bug: https://bugs.gentoo.org/730406 Reported-by: Daniel Santos Bug: https://gcc.gnu.org/PR98441 Bug: https://bugs.gentoo.org/762382 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/README.history | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index 81678b5..48587e1 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -1,4 +1,4 @@ -6 TODO +6 29 Dec 2020 - 34_all_fundecl-ICE-PR95820.patch 5 18 Dec 2020
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: bb00f570a7d3f1d0e4233f8d353fb9c56f3a55cc Author: Sergei Trofimovich gentoo org> AuthorDate: Thu Sep 10 21:37:36 2020 + Commit: Sergei Trofimovich gentoo org> CommitDate: Thu Sep 10 21:37:36 2020 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=bb00f570 10.2.0: fix TOPN counters when logged from shared library The change does not yet fix underlying problem of recursive inliner. Bug: https://gcc.gnu.org/PR96913 Bug: https://gcc.gnu.org/PR96394 Bug: https://bugs.gentoo.org/734006 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/38_all_gcov-TOPN-PR96913.patch | 42 10.2.0/gentoo/README.history | 1 + 2 files changed, 43 insertions(+) diff --git a/10.2.0/gentoo/38_all_gcov-TOPN-PR96913.patch b/10.2.0/gentoo/38_all_gcov-TOPN-PR96913.patch new file mode 100644 index 000..5c301e4 --- /dev/null +++ b/10.2.0/gentoo/38_all_gcov-TOPN-PR96913.patch @@ -0,0 +1,42 @@ +https://gcc.gnu.org/PR96913 +https://gcc.gnu.org/PR96394 +https://bugs.gentoo.org/734006 + +From ae887148e112e018bec0bab5bc15e53f2225037a Mon Sep 17 00:00:00 2001 +From: Sergei Trofimovich +Date: Sun, 6 Sep 2020 12:13:54 +0100 +Subject: [PATCH] gcov: fix TOPN streaming from shared libraries + +Before the change gcc did not stream correctly TOPN counters +if counters belonged to a non-local shared object. + +As a result zero-section optimization generated TOPN sections +in a form not recognizable by '__gcov_merge_topn'. + +The problem happens because in a case of multiple shared objects +'__gcov_merge_topn' function is present in address space multiple +times (once per each object). + +The fix is to never rely on function address and predicate on TOPN +counter types. + +libgcc/ChangeLog: + + PR gcov-profile/96913 + * libgcov-driver.c (write_one_data): Avoid function pointer + comparison in TOP streaming decision. +--- + libgcc/libgcov-driver.c | 7 ++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +--- a/libgcc/libgcov-driver.c b/libgcc/libgcov-driver.c +@@ -242,7 +242,7 @@ prune_counters (struct gcov_info *gi) + if (gi->merge[j] == NULL) + continue; + +-if (gi->merge[j] == __gcov_merge_topn) ++if (j == GCOV_COUNTER_V_TOPN || j == GCOV_COUNTER_V_INDIR) + { + gcc_assert (!(ci->num % GCOV_TOPN_VALUES_COUNTERS)); + for (unsigned k = 0; k < (ci->num / GCOV_TOPN_VALUES_COUNTERS); diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index 3fbcbfd..6d00c5a 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -1,6 +1,7 @@ 3 TODO U 28_all_EXTRA_OPTIONS-fstack-clash-protection.patch + 37_all_c-vector-init-PR96377.patch + + 38_all_gcov-TOPN-PR96913.patch 2 23 Aug 2020 + 33_all_lto-O0-mix-ICE-ipa-PR96291.patch
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: 064908a8c0b537e980721c7996d276e1901924db Author: Sergei Trofimovich gentoo org> AuthorDate: Thu Jul 23 08:15:06 2020 + Commit: Sergei Trofimovich gentoo org> CommitDate: Thu Jul 23 08:15:06 2020 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=064908a8 10.2.0: cut 1 patchset Based on gcc-10.1.0 patchset. The only change is upstreamed backportes: - 29_all_fix-float-hang-PR95118.patch - 31_all_ctor-range-PR95241.patch - 33_all_avx512-scalar-PR95528.patch - 34_all_cet-cross-x86.patch - 35_all_ICE-array-subscript-PR95508.patch - 38_all_ICE-ipa-fnsummary-PR96130.patch Bug: https://gcc.gnu.org/PR96190 Bug: https://bugs.gentoo.org/619706 Bug: https://gcc.gnu.org/PR96130 Bug: https://bugs.gentoo.org/733246 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/01_all_default-fortify-source.patch | 22 .../02_all_default-warn-format-security.patch | 22 .../gentoo/03_all_default-warn-trampolines.patch | 13 ++ 10.2.0/gentoo/04_all_nossp-on-nostdlib.patch | 27 10.2.0/gentoo/05_all_alpha-mieee-default.patch | 39 ++ 10.2.0/gentoo/06_all_ia64_note.GNU-stack.patch | 92 + .../gentoo/07_all_i386_libgcc_note.GNU-stack.patch | 54 10.2.0/gentoo/08_all_libiberty-asprintf.patch | 18 +++ 10.2.0/gentoo/09_all_libiberty-pic.patch | 10 ++ 10.2.0/gentoo/10_all_nopie-all-flags.patch | 18 +++ 10.2.0/gentoo/11_all_sh-drop-sysroot-suffix.patch | 32 + 10.2.0/gentoo/12_all_ia64-TEXTREL.patch| 22 .../gentoo/13_all_disable-systemtap-switch.patch | 122 ++ 10.2.0/gentoo/14_all_m68k-textrel-on-libgcc.patch | 93 ++ 10.2.0/gentoo/15_all_respect-build-cxxflags.patch | 39 ++ 10.2.0/gentoo/16_all_libgfortran-Werror.patch | 20 +++ 10.2.0/gentoo/17_all_libgomp-Werror.patch | 20 +++ 10.2.0/gentoo/18_all_libitm-Werror.patch | 19 +++ 10.2.0/gentoo/19_all_libatomic-Werror.patch| 19 +++ 10.2.0/gentoo/20_all_libbacktrace-Werror.patch | 17 +++ 10.2.0/gentoo/21_all_libsanitizer-Werror.patch | 17 +++ 10.2.0/gentoo/22_all_libstdcxx-no-vtv.patch| 61 + 10.2.0/gentoo/23_all_disable-riscv32-ABIs.patch| 53 10.2.0/gentoo/24_all_default_ssp-buffer-size.patch | 14 ++ 10.2.0/gentoo/25_all_hppa-faster-synth_mult.patch | 44 +++ 10.2.0/gentoo/26_all_libcpp-ar.patch | 143 + 10.2.0/gentoo/27_all_EXTRA_OPTIONS-z-now.patch | 26 ...all_EXTRA_OPTIONS-fstack-clash-protection.patch | 65 ++ .../29_all_lto-intl-workaround-PR95194.patch | 20 +++ 10.2.0/gentoo/30_all_plugin-objdump.patch | 34 + 10.2.0/gentoo/31_all_fno-delayed-branch.patch | 40 ++ 10.2.0/gentoo/32_all_sparc_pie_TEXTREL.patch | 49 +++ 10.2.0/gentoo/README.history | 33 + 33 files changed, 1317 insertions(+) diff --git a/10.2.0/gentoo/01_all_default-fortify-source.patch b/10.2.0/gentoo/01_all_default-fortify-source.patch new file mode 100644 index 000..d307474 --- /dev/null +++ b/10.2.0/gentoo/01_all_default-fortify-source.patch @@ -0,0 +1,22 @@ +Taken Debian's patch and removed docs matches: +https://salsa.debian.org/toolchain-team/gcc.git +Also see https://bugs.gentoo.org/621036 where +initially Gentoo used too complicated macro. + +# DP: Turn on -D_FORTIFY_SOURCE=2 by default for C, C++, ObjC, ObjC++, +# DP: if the optimization level is > 0 +--- a/gcc/c-family/c-cppbuiltin.c b/gcc/c-family/c-cppbuiltin.c +@@ -951,6 +951,12 @@ c_cpp_builtins (cpp_reader *pfile) + builtin_define_with_value ("__REGISTER_PREFIX__", REGISTER_PREFIX, 0); + builtin_define_with_value ("__USER_LABEL_PREFIX__", user_label_prefix, 0); + ++#if !defined(ACCEL_COMPILER) ++ /* Fortify Source enabled by default for optimization levels > 0 */ ++ if (optimize) ++builtin_define_with_int_value ("_FORTIFY_SOURCE", 2); ++#endif ++ + /* Misc. */ + if (flag_gnu89_inline) + cpp_define (pfile, "__GNUC_GNU_INLINE__"); diff --git a/10.2.0/gentoo/02_all_default-warn-format-security.patch b/10.2.0/gentoo/02_all_default-warn-format-security.patch new file mode 100644 index 000..f809abd --- /dev/null +++ b/10.2.0/gentoo/02_all_default-warn-format-security.patch @@ -0,0 +1,22 @@ +Enable -Wformat and -Wformat-security by default. + +--- a/gcc/c-family/c.opt 2016-03-23 18:51:56.0 +0100 b/gcc/c-family/c.opt 2016-04-28 23:45:54.063351272 +0200 +@@ -459,7 +459,7 @@ C ObjC C++ ObjC++ Var(warn_format_nonlit + Warn about format strings that are not literals. + + Wformat-security +-C ObjC C++ ObjC++ Var(warn_format_security) Warning LangEnabledBy(C ObjC C++ ObjC++,Wformat=, warn_format >= 2, 0) ++C ObjC C++ ObjC++ Var(warn_format_security) Init(1) Warning LangEnabledBy(C ObjC C++ ObjC++,Wformat=, warn_format >= 2, 0) + Warn about possible security problems
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: 8f9b6cda0cd772b5155d52a5effabd04fd656a18 Author: Sergei Trofimovich gentoo org> AuthorDate: Sun Jul 26 10:34:45 2020 + Commit: Sergei Trofimovich gentoo org> CommitDate: Sun Jul 26 10:34:45 2020 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=8f9b6cda 10.2.0: fix IPA ICE on LTO -O0/-O2 mix Bug: https://bugs.gentoo.org/733482 Bug: https://gcc.gnu.org/PR96291 Signed-off-by: Sergei Trofimovich gentoo.org> .../gentoo/33_all_lto-O0-mix-ICE-ipa-PR96291.patch | 46 ++ 10.2.0/gentoo/README.history | 3 ++ 2 files changed, 49 insertions(+) diff --git a/10.2.0/gentoo/33_all_lto-O0-mix-ICE-ipa-PR96291.patch b/10.2.0/gentoo/33_all_lto-O0-mix-ICE-ipa-PR96291.patch new file mode 100644 index 000..b163721 --- /dev/null +++ b/10.2.0/gentoo/33_all_lto-O0-mix-ICE-ipa-PR96291.patch @@ -0,0 +1,46 @@ +https://bugs.gentoo.org/733482 +https://gcc.gnu.org/PR96291 + +From 03810b1b2dec00575b2bcb579eb3d7c34bd176bc Mon Sep 17 00:00:00 2001 +From: Sergei Trofimovich +Date: Sat, 25 Jul 2020 19:26:50 +0100 +Subject: [PATCH] ipa/96291: don't crash on unoptimized lto functions + +In PR ipa/96291 the test contained an SCC with one +unoptimized function. This tricked ipa-cp into NULL dereference. + +has_undead_caller_from_outside_scc_p() did not take into account +that unoptimized funtions don't have IPA summary analysis. and +dereferenced NULL pointer causing an ICE. + + PR ipa/96291 + * ipa-cp.c (has_undead_caller_from_outside_scc_p): Consider + unoptimized callers as undead. +--- + gcc/ipa-cp.c | 12 +--- + 1 file changed, 9 insertions(+), 3 deletions(-) + +--- a/gcc/ipa-cp.c b/gcc/ipa-cp.c +@@ -5666,9 +5666,15 @@ has_undead_caller_from_outside_scc_p (struct cgraph_node *node, + && cs->caller->call_for_symbol_thunks_and_aliases + (has_undead_caller_from_outside_scc_p, NULL, true)) + return true; +-else if (!ipa_edge_within_scc (cs) +- && !IPA_NODE_REF (cs->caller)->node_dead) +- return true; ++else if (!ipa_edge_within_scc (cs)) ++ { ++ /* Unoptimized callers don't have IPA information. ++ Conservatively assume callers are undead. */ ++ if (!IPA_NODE_REF (cs->caller)) ++return true; ++ if (!IPA_NODE_REF (cs->caller)->node_dead) ++return true; ++ } + return false; + } + +-- +2.27.0 + diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index 4009f39..1c0fff9 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -1,3 +1,6 @@ +2 TODO + + 33_all_lto-O0-mix-ICE-ipa-PR96291.patch + 1 23 July 2020 + 01_all_default-fortify-source.patch + 02_all_default-warn-format-security.patch
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: fafbb4148cb5c2cf7e1ae02679240cba43e95992 Author: Sergei Trofimovich gentoo org> AuthorDate: Mon Jul 27 06:48:54 2020 + Commit: Sergei Trofimovich gentoo org> CommitDate: Mon Jul 27 06:48:54 2020 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=fafbb414 10.2.0: backport ICE on invalid function declarations Reported-by: Jack Ostroff Bug: https://bugs.gentoo.org/730406 Bug: https://gcc.gnu.org/PR95820 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/34_all_fundecl-ICE-PR95820.patch | 25 + 10.2.0/gentoo/README.history | 1 + 2 files changed, 26 insertions(+) diff --git a/10.2.0/gentoo/34_all_fundecl-ICE-PR95820.patch b/10.2.0/gentoo/34_all_fundecl-ICE-PR95820.patch new file mode 100644 index 000..e365420 --- /dev/null +++ b/10.2.0/gentoo/34_all_fundecl-ICE-PR95820.patch @@ -0,0 +1,25 @@ +It's an unofficial backport of PR95820 where gcc ICEs on +invalid syntax. As creduce frequently end up in these ICEs +as in #730406 let's backport it to gcc-10. + +https://gcc.gnu.org/PR95820 +https://bugs.gentoo.org/730406 +--- a/gcc/cp/decl.c b/gcc/cp/decl.c +@@ -12029,14 +12029,11 @@ grokdeclarator (const cp_declarator *declarator, + + /* Handle a late-specified return type. */ + tree late_return_type = declarator->u.function.late_return_type; +- if (funcdecl_p +- /* This is the case e.g. for +- using T = auto () -> int. */ +- || inner_declarator == NULL) ++ if (true) + { + if (tree auto_node = type_uses_auto (type)) + { +- if (!late_return_type) ++ if (!late_return_type && funcdecl_p) + { + if (current_class_type + && LAMBDA_TYPE_P (current_class_type)) diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index 1c0fff9..7cde6a3 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -1,5 +1,6 @@ 2 TODO + 33_all_lto-O0-mix-ICE-ipa-PR96291.patch + + 34_all_fundecl-ICE-PR95820.patch 1 23 July 2020 + 01_all_default-fortify-source.patch
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: bb31009f6bb62d2dbee6a4be9605c9286ef0df23 Author: Sergei Trofimovich gentoo org> AuthorDate: Thu Oct 15 17:30:51 2020 + Commit: Sergei Trofimovich gentoo org> CommitDate: Thu Oct 15 17:30:51 2020 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=bb31009f 10.2.0: backport IPA to_frequency() ICE Reported-by: inasprecali disroot.org Bug: https://bugs.gentoo.org/746578 Bug: https://gcc.gnu.org/PR97295 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/40_all_ipa-to_frequency.patch | 48 + 10.2.0/gentoo/README.history| 3 ++ 2 files changed, 51 insertions(+) diff --git a/10.2.0/gentoo/40_all_ipa-to_frequency.patch b/10.2.0/gentoo/40_all_ipa-to_frequency.patch new file mode 100644 index 000..0849207 --- /dev/null +++ b/10.2.0/gentoo/40_all_ipa-to_frequency.patch @@ -0,0 +1,48 @@ +https://bugs.gentoo.org/746578 +https://gcc.gnu.org/PR97295 + +From 508e2d88a4c512e8b8685cf5ba201ad48e6bb58d Mon Sep 17 00:00:00 2001 +From: Martin Liska +Date: Tue, 13 Oct 2020 16:44:47 +0200 +Subject: [PATCH] IPA: fix profile handling in IRA + +gcc/ChangeLog: + + PR ipa/97295 + * profile-count.c (profile_count::to_frequency): Move part of + gcc_assert to STATIC_ASSERT. + * regs.h (REG_FREQ_FROM_BB): Do not use count.to_frequency for + a function that does not have count_max initialized. +--- + gcc/profile-count.c | 4 ++-- + gcc/regs.h | 3 ++- + 2 files changed, 4 insertions(+), 3 deletions(-) + +--- a/gcc/profile-count.c b/gcc/profile-count.c +@@ -270,8 +270,8 @@ profile_count::to_frequency (struct function *fun) const + return BB_FREQ_MAX; + if (*this == zero ()) + return 0; +- gcc_assert (REG_BR_PROB_BASE == BB_FREQ_MAX +-&& fun->cfg->count_max.initialized_p ()); ++ STATIC_ASSERT (REG_BR_PROB_BASE == BB_FREQ_MAX); ++ gcc_assert (fun->cfg->count_max.initialized_p ()); + profile_probability prob = probability_in (fun->cfg->count_max); + if (!prob.initialized_p ()) + return REG_BR_PROB_BASE; +--- a/gcc/regs.h b/gcc/regs.h +@@ -128,7 +128,8 @@ extern size_t reg_info_p_size; +or profile driven feedback is available and the function is never executed, +frequency is always equivalent. Otherwise rescale the basic block +frequency. */ +-#define REG_FREQ_FROM_BB(bb) (optimize_function_for_size_p (cfun) \ ++#define REG_FREQ_FROM_BB(bb) ((optimize_function_for_size_p (cfun) \ ++ || !cfun->cfg->count_max.initialized_p ()) \ + ? REG_FREQ_MAX \ + : ((bb)->count.to_frequency (cfun) \ + * REG_FREQ_MAX / BB_FREQ_MAX) \ +-- +2.28.0 + diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index 86f3aae..e419e62 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -1,3 +1,6 @@ +4 TODO + + 40_all_ipa-to_frequency.patch + 3 02 Oct 2020 U 28_all_EXTRA_OPTIONS-fstack-clash-protection.patch + 37_all_c-vector-init-PR96377.patch
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: 7bf989ed8b53a13de6a6551b7f346b1dcadf5966 Author: Sergei Trofimovich gentoo org> AuthorDate: Fri Oct 2 09:12:10 2020 + Commit: Sergei Trofimovich gentoo org> CommitDate: Fri Oct 2 09:12:10 2020 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=7bf989ed 10.2.0: fix multiple speculation resolution on prog builds Reported-by: Ștefan Talpalaru Bug: https://gcc.gnu.org/PR96394 Bug: https://bugs.gentoo.org/734006 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/39_all_ipa-prop-multispec.patch | 150 ++ 10.2.0/gentoo/README.history | 1 + 2 files changed, 151 insertions(+) diff --git a/10.2.0/gentoo/39_all_ipa-prop-multispec.patch b/10.2.0/gentoo/39_all_ipa-prop-multispec.patch new file mode 100644 index 000..6e19992 --- /dev/null +++ b/10.2.0/gentoo/39_all_ipa-prop-multispec.patch @@ -0,0 +1,150 @@ +https://gcc.gnu.org/PR96394 +https://bugs.gentoo.org/734006 + +From 7f790f414ec38581b9bb033ab64e4ad12b9f8a4c Mon Sep 17 00:00:00 2001 +From: Martin Jambor +Date: Thu, 1 Oct 2020 19:39:27 +0200 +Subject: [PATCH] ipa-prop: Fix multiple-target speculation resolution + +Hi, + +as the FIXME which this patch removes states, the current code does +not work when a call with multiple speculative targets gets resolved +through parameter tracking during inlining - it feeds the inliner an +edge it has already dealt with. The patch makes the code which should +prevent it aware of the possibility that that speculation can have +more than one target now. + +Bootstrapped and tested and LTO bootstrapped on x86_64-linux. I did not +try profiled LTO bootstrap because it fails even without the patch (even +without Ada, just C, C++ and Fortran, at least commit 92f0d3d03a7 does). +OK for trunk? + +Thanks, + +Martin + +gcc/ChangeLog: + +2020-09-30 Martin Jambor + + PR ipa/96394 + * ipa-prop.c (update_indirect_edges_after_inlining): Do not add + resolved speculation edges to vector of new direct edges even in + presence of multiple speculative direct edges for a single call. + +gcc/testsuite/ChangeLog: + +2020-09-30 Martin Jambor + + PR ipa/96394 + * gcc.dg/tree-prof/pr96394.c: New test. +--- + gcc/ipa-prop.c | 10 ++-- + gcc/testsuite/gcc.dg/tree-prof/pr96394.c | 64 + 2 files changed, 70 insertions(+), 4 deletions(-) + create mode 100644 gcc/testsuite/gcc.dg/tree-prof/pr96394.c + +diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c +index ea88fd3fd95..0ff04d344e1 100644 +--- a/gcc/ipa-prop.c b/gcc/ipa-prop.c +@@ -3787,11 +3787,13 @@ update_indirect_edges_after_inlining (struct cgraph_edge *cs, + + param_index = ici->param_index; + jfunc = ipa_get_ith_jump_func (top, param_index); +- cgraph_node *spec_target = NULL; + +- /* FIXME: This may need updating for multiple calls. */ ++ auto_vec spec_targets; + if (ie->speculative) +- spec_target = ie->first_speculative_call_target ()->callee; ++ for (cgraph_edge *direct = ie->first_speculative_call_target (); ++ direct; ++ direct = direct->next_speculative_call_target ()) ++spec_targets.safe_push (direct->callee); + + if (!opt_for_fn (node->decl, flag_indirect_inlining)) + new_direct_edge = NULL; +@@ -3814,7 +3816,7 @@ update_indirect_edges_after_inlining (struct cgraph_edge *cs, + + /* If speculation was removed, then we need to do nothing. */ + if (new_direct_edge && new_direct_edge != ie +-&& new_direct_edge->callee == spec_target) ++&& spec_targets.contains (new_direct_edge->callee)) + { + new_direct_edge->indirect_inlining_edge = 1; + top = IPA_EDGE_REF (cs); +diff --git a/gcc/testsuite/gcc.dg/tree-prof/pr96394.c b/gcc/testsuite/gcc.dg/tree-prof/pr96394.c +new file mode 100644 +index 000..4280182a7c3 +--- /dev/null b/gcc/testsuite/gcc.dg/tree-prof/pr96394.c +@@ -0,0 +1,64 @@ ++/* PR ipa/96394 */ ++/* { dg-options "-O2" } */ ++ ++typedef struct _entry { ++int has_next; ++int next_ix; ++int count; ++} entry; ++ ++extern entry table[]; ++ ++void * ++__attribute__((noipa)) ++PyErr_Format(entry * e){ return 0; } ++ ++void ae(entry *); ++int h(entry *); ++int ap(entry *); ++int ag(entry *); ++ ++int ag(entry *j) { ++ if (j->has_next) ++h(&table[j->next_ix]); ++ return 0; ++} ++static int ai(entry *j, int k(entry *), int l, int m) { ++ int am = 1; ++ int ab; ++ ++ /* k is either 'h' or 'ap': 50%/50% */ ++ ab = k(j); ++ ++ /* loop never gets executed on real data */ ++ for (; j->count >= 2; am += 2) ++if (l) { ++ entry *i = &table[am + m]; ++ PyErr_Format(i); ++} ++ return ab; ++} ++void ++__attribute__((noipa)) ++bug() { ++ h(table); ++ h(table); ++} ++int h(entry *j) { return ai(j, ap, 4, 5); } ++int ap(entry *j) { return ai(j, ag, 14, 4); } ++ ++int main(void) ++{ ++bug(); ++} ++ ++entry
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: b4972ce62b04aafc6061836a92f0cebbadd80d7a Author: Sergei Trofimovich gentoo org> AuthorDate: Fri Oct 2 09:22:40 2020 + Commit: Sergei Trofimovich gentoo org> CommitDate: Fri Oct 2 09:22:40 2020 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=b4972ce6 10.2.0: cut 3 patchset three new patches: + 37_all_c-vector-init-PR96377.patch: fix vector init on arm + 38_all_gcov-TOPN-PR96913.patch: fix TOPN prof counters in shared libraries + 39_all_ipa-prop-multispec.patch: fix multiple speculation resolution on prof builds Bug: https://gcc.gnu.org/PR96377 Bug: https://gcc.gnu.org/PR96913 Bug: https://bugs.gentoo.org/734006 Bug: https://gcc.gnu.org/PR96394 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/README.history | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index 5929aae..86f3aae 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -1,4 +1,4 @@ -3 TODO +3 02 Oct 2020 U 28_all_EXTRA_OPTIONS-fstack-clash-protection.patch + 37_all_c-vector-init-PR96377.patch + 38_all_gcov-TOPN-PR96913.patch
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: 9b342fdeb8588681bb106e072cefd481a045fb21 Author: Sergei Trofimovich gentoo org> AuthorDate: Tue Dec 1 19:16:33 2020 + Commit: Sergei Trofimovich gentoo org> CommitDate: Tue Dec 1 19:16:33 2020 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=9b342fde 10.2.0: backport strncmp() folding Reported-by: Matt Whitlock Bug: https://bugs.gentoo.org/757792 Bug: https://gcc.gnu.org/PR96758 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/41_all_strlen-PR96758.patch | 95 +++ 10.2.0/gentoo/README.history | 3 + 2 files changed, 98 insertions(+) diff --git a/10.2.0/gentoo/41_all_strlen-PR96758.patch b/10.2.0/gentoo/41_all_strlen-PR96758.patch new file mode 100644 index 000..fccf2de --- /dev/null +++ b/10.2.0/gentoo/41_all_strlen-PR96758.patch @@ -0,0 +1,95 @@ +https://bugs.gentoo.org/757792 + +From 0dbfa88edafbe913a7a9099246041e0190aa3948 Mon Sep 17 00:00:00 2001 +From: Jakub Jelinek +Date: Tue, 25 Aug 2020 13:47:10 +0200 +Subject: [PATCH] strlen: Fix handle_builtin_string_cmp [PR96758] + +The following testcase is miscompiled, because handle_builtin_string_cmp +sees a strncmp call with constant last argument 4, where one of the strings +has an upper bound of 5 bytes (due to it being an array of that size) and +the other has a known string length of 1 and the result is used only in +equality comparison. +It is folded into __builtin_strncmp_eq (str1, str2, 4), which is +incorrect, because that means reading 4 bytes from both strings and +comparing that. When one of the strings has known strlen of 1, we want to +compare just 2 bytes, not 4, as strncmp shouldn't compare any bytes beyond +the null. +So, the last argument to __builtin_strncmp_eq should be the minimum of the +provided strncmp last argument and the known string length + 1 (assuming +the other string has only a known upper bound due to array size). + +Besides that, I've noticed the code has been written with the intent to also +support the case where we know exact string length of both strings (but not +the string content, so we can't compute it at compile time). In that case, +both cstlen1 and cstlen2 are non-negative and both arysiz1 and arysiz2 are +negative. We wouldn't optimize that, cmpsiz would be either the strncmp +last argument, or for strcmp the first string length, but varsiz would be +-1 and thus cmpsiz would be never < varsiz. The patch fixes it by using the +correct length, in that case using the minimum of the two and for strncmp +also the last argument. + +2020-08-25 Jakub Jelinek + + PR tree-optimization/96758 + * tree-ssa-strlen.c (handle_builtin_string_cmp): If both cstlen1 + and cstlen2 are set, set cmpsiz to their minimum, otherwise use the + one that is set. If bound is used and smaller than cmpsiz, set cmpsiz + to bound. If both cstlen1 and cstlen2 are set, perform the optimization. + + * gcc.dg/strcmpopt_12.c: New test. + +(cherry picked from commit f982a6ec9b6d98f5f37114b1d7455c54ce5056b8) +--- + gcc/testsuite/gcc.dg/strcmpopt_12.c | 17 + + gcc/tree-ssa-strlen.c | 10 +- + 2 files changed, 26 insertions(+), 1 deletion(-) + create mode 100644 gcc/testsuite/gcc.dg/strcmpopt_12.c + +diff --git a/gcc/testsuite/gcc.dg/strcmpopt_12.c b/gcc/testsuite/gcc.dg/strcmpopt_12.c +new file mode 100644 +index 000..d8077b62f7f +--- /dev/null b/gcc/testsuite/gcc.dg/strcmpopt_12.c +@@ -0,0 +1,17 @@ ++/* PR tree-optimization/96758 */ ++/* { dg-do run } */ ++/* { dg-options "-O2" } */ ++ ++int v = 1; ++ ++int ++main () ++{ ++ const char *s = v ? "a" : "b"; ++ char x[5]; ++ char y[5] = "a\0a"; ++ __builtin_memcpy (x, y, sizeof (y)); ++ if (__builtin_strncmp (x, s, 4) != 0) ++__builtin_abort (); ++ return 0; ++} +diff --git a/gcc/tree-ssa-strlen.c b/gcc/tree-ssa-strlen.c +index 93d095e1896..b0874da5d1e 100644 +--- a/gcc/tree-ssa-strlen.c b/gcc/tree-ssa-strlen.c +@@ -4485,7 +4485,15 @@ handle_builtin_string_cmp (gimple_stmt_iterator *gsi, const vr_values *rvals) + ++cstlen2; + + /* The exact number of characters to compare. */ +- HOST_WIDE_INT cmpsiz = bound < 0 ? cstlen1 < 0 ? cstlen2 : cstlen1 : bound; ++ HOST_WIDE_INT cmpsiz; ++ if (cstlen1 >= 0 && cstlen2 >= 0) ++cmpsiz = MIN (cstlen1, cstlen2); ++ else if (cstlen1 >= 0) ++cmpsiz = cstlen1; ++ else ++cmpsiz = cstlen2; ++ if (bound >= 0) ++cmpsiz = MIN (cmpsiz, bound); + /* The size of the array in which the unknown string is stored. */ + HOST_WIDE_INT varsiz = arysiz1 < 0 ? arysiz2 : arysiz1; + +-- +2.29.2 + diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index e0207e7..8b8c475 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -1,3 +1,6 @@ +5 TODO + + 41_all_strlen-PR96758.patch + 4 04 Nov 2020 + 40_all_ipa-to_frequency.patch
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: 7ecc76113ad46206cbe6e8bdc1ca39bee97be4dd Author: Sergei Trofimovich gentoo org> AuthorDate: Thu Sep 3 17:11:15 2020 + Commit: Sergei Trofimovich gentoo org> CommitDate: Thu Sep 3 17:11:15 2020 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=7ecc7611 10.2.0: backport PR96377 (c vector init syntax) Bug: https://gcc.gnu.org/PR96377 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/37_all_c-vector-init-PR96377.patch | 522 +++ 10.2.0/gentoo/README.history | 1 + 2 files changed, 523 insertions(+) diff --git a/10.2.0/gentoo/37_all_c-vector-init-PR96377.patch b/10.2.0/gentoo/37_all_c-vector-init-PR96377.patch new file mode 100644 index 000..7ef9cdd --- /dev/null +++ b/10.2.0/gentoo/37_all_c-vector-init-PR96377.patch @@ -0,0 +1,522 @@ +https://gcc.gnu.org/PR96377 + +From a216daaa30bc8949086a16e7656f2025b692d03c Mon Sep 17 00:00:00 2001 +From: Richard Sandiford +Date: Mon, 3 Aug 2020 09:48:36 +0100 +Subject: [PATCH] c: Fix bogus vector initialisation error [PR96377] + +One of the problems in this PR was that if we had: + + vector_type1 array[] = { vector_value1 }; + +process_init_element would only treat vector_value1 as initialising +a vector_type1 if they had the same TYPE_MAIN_VARIANT. This has +several problems: + +(1) It gives confusing error messages if the vector types are +incompatible. (Tested by gcc.dg/pr96377-1.c.) + +(2) It means that we reject code that should be valid with +-flax-vector-conversions. (Tested by gcc.dg/pr96377-2.c.) + +(3) On arm and aarch64 targets, it means that we reject some +initializers that mix Advanced SIMD and standard GNU vectors. +These vectors have traditionally had different TYPE_MAIN_VARIANTs +because they have different mangling schemes. (Tested by +gcc.dg/pr96377-[3-6].c.) + +(4) It means that we reject SVE initializers that should be valid. +(Tested by gcc.target/aarch64/sve/gnu_vectors_[34].c.) + +(5) After r11-1741-g:31427b974ed7b7dd54e2 we reject: + + arm_neon_type1 array[] = { k ^ arm_neon_value1 }; + +because applying the binary operator to arm_neon_value1 strips +the "Advanced SIMD type" attributes that were added in that patch. +Stripping the attributes is problematic for other reasons though, +so that still needs to be fixed separately. + +g++.target/aarch64/sve/gnu_vectors_[34].C already pass. + +gcc/c/ + PR c/96377 + * c-typeck.c (process_init_element): Split test for whether to + recurse into a record, union or array into... + (initialize_elementwise_p): ...this new function. Don't recurse + into a vector type if the initialization value is also a vector. + +gcc/testsuite/ + PR c/96377 + * gcc.dg/pr96377-1.c: New test. + * gcc.dg/pr96377-2.c: Likewise. + * gcc.dg/pr96377-3.c: Likewise. + * gcc.dg/pr96377-4.c: Likewise. + * gcc.dg/pr96377-5.c: Likewise. + * gcc.dg/pr96377-6.c: Likewise. + * gcc.target/aarch64/pr96377-1.c: Likewise. + * gcc.target/aarch64/sve/acle/general-c/gnu_vectors_3.c: Likewise. + * gcc.target/aarch64/sve/acle/general-c/gnu_vectors_4.c: Likewise. + * g++.target/aarch64/sve/acle/general-c++/gnu_vectors_3.C: Likewise. + * g++.target/aarch64/sve/acle/general-c++/gnu_vectors_4.C: Likewise. + +(cherry picked from commit 7d599ad27b9bcf5165f87710f1abc64bbabd06ae) +--- + gcc/c/c-typeck.c | 59 ++- + .../sve/acle/general-c++/gnu_vectors_3.C | 15 + + .../sve/acle/general-c++/gnu_vectors_4.C | 15 + + gcc/testsuite/gcc.dg/pr96377-1.c | 32 ++ + gcc/testsuite/gcc.dg/pr96377-2.c | 31 ++ + gcc/testsuite/gcc.dg/pr96377-3.c | 33 +++ + gcc/testsuite/gcc.dg/pr96377-4.c | 32 ++ + gcc/testsuite/gcc.dg/pr96377-5.c | 33 +++ + gcc/testsuite/gcc.dg/pr96377-6.c | 32 ++ + gcc/testsuite/gcc.target/aarch64/pr96377-1.c | 20 +++ + .../sve/acle/general-c/gnu_vectors_3.c| 15 + + .../sve/acle/general-c/gnu_vectors_4.c| 15 + + 12 files changed, 317 insertions(+), 15 deletions(-) + create mode 100644 gcc/testsuite/g++.target/aarch64/sve/acle/general-c++/gnu_vectors_3.C + create mode 100644 gcc/testsuite/g++.target/aarch64/sve/acle/general-c++/gnu_vectors_4.C + create mode 100644 gcc/testsuite/gcc.dg/pr96377-1.c + create mode 100644 gcc/testsuite/gcc.dg/pr96377-2.c + create mode 100644 gcc/testsuite/gcc.dg/pr96377-3.c + create mode 100644 gcc/testsuite/gcc.dg/pr96377-4.c + create mode 100644 gcc/testsuite/gcc.dg/pr96377-5.c + create mode 100644 gcc/testsuite/gcc.dg/pr96377-6.c + create mode 100644 gcc/testsuite/gcc.target/aarch64/pr96377-1.c + create mode 100644 gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/gnu_vectors_3.c + create mode 100644 gcc/testsuite/gcc.target/aarch64/sve
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: c446f6f37e5a5f0867527acdb0b78333e3b70822 Author: Sergei Trofimovich gentoo org> AuthorDate: Thu Aug 13 08:39:49 2020 + Commit: Sergei Trofimovich gentoo org> CommitDate: Thu Aug 13 08:39:49 2020 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=c446f6f3 10.2.0:backport ipa-cp bit fix (PR/96482) Reported-by: Johannes Hirte Bug: https://bugs.gentoo.org/736685 Bug: https://gcc.gnu.org/PR96482 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/35_all_ipa-fix-bit-CP.patch | 145 ++ 10.2.0/gentoo/README.history | 1 + 2 files changed, 146 insertions(+) diff --git a/10.2.0/gentoo/35_all_ipa-fix-bit-CP.patch b/10.2.0/gentoo/35_all_ipa-fix-bit-CP.patch new file mode 100644 index 000..34a1fe0 --- /dev/null +++ b/10.2.0/gentoo/35_all_ipa-fix-bit-CP.patch @@ -0,0 +1,145 @@ +https://bugs.gentoo.org/736685 +https://gcc.gnu.org/PR96482 + +From 66780083a0e79e5cb7c3acc8665aa47be4084a67 Mon Sep 17 00:00:00 2001 +From: Martin Liska +Date: Wed, 12 Aug 2020 09:21:51 +0200 +Subject: [PATCH] ipa: fix bit CPP when combined with IPA bit CP + +As mentioned in the PR, let's consider the following example: + +int +__attribute__((noinline)) +foo(int arg) +{ + if (arg == 3) +return 1; + if (arg == 4) +return 123; + + __builtin_unreachable (); +} + +during WPA we find all calls of the function +(yes the call with value 5 is UBSAN): + + Node: foo/0: +param [0]: 5 [loc_time: 4, loc_size: 2, prop_time: 0, prop_size: 0] + 3 [loc_time: 3, loc_size: 3, prop_time: 0, prop_size: 0] + ctxs: VARIABLE + Bits: value = 0x5, mask = 0x6 + +in LTRANS we have the following VRP info: + + # RANGE [3, 3] NONZERO 3 + +when we AND masks in get_default_value we end up with 6 & 3 = 2 (0x010). +That means the only second (least significant bit) is unknown and +value (5 = 0x101) & ~mask gives us either 7 (0x111) or 5 (0x101). + +That's why if (arg_2(D) == 3) gets optimized to false. + +gcc/ChangeLog: + + PR ipa/96482 + * ipa-cp.c (ipcp_bits_lattice::meet_with_1): Drop value bits + for bits that are unknown. + (ipcp_bits_lattice::set_to_constant): Likewise. + * tree-ssa-ccp.c (get_default_value): Add sanity check that + IPA CP bit info has all bits set to zero in bits that + are unknown. + +gcc/testsuite/ChangeLog: + + PR ipa/96482 + * gcc.dg/ipa/pr96482.c: New test. + +(cherry picked from commit d58f078ce2d53e5dab6b3d0d5f960504268e1894) +--- + gcc/ipa-cp.c | 3 +- + gcc/testsuite/gcc.dg/ipa/pr96482.c | 44 ++ + gcc/tree-ssa-ccp.c | 3 ++ + 3 files changed, 49 insertions(+), 1 deletion(-) + create mode 100644 gcc/testsuite/gcc.dg/ipa/pr96482.c + +--- a/gcc/ipa-cp.c b/gcc/ipa-cp.c +@@ -1010,7 +1010,7 @@ ipcp_bits_lattice::set_to_constant (widest_int value, widest_int mask) + { + gcc_assert (top_p ()); + m_lattice_val = IPA_BITS_CONSTANT; +- m_value = value; ++ m_value = wi::bit_and (wi::bit_not (mask), value); + m_mask = mask; + return true; + } +@@ -1047,6 +1047,7 @@ ipcp_bits_lattice::meet_with_1 (widest_int value, widest_int mask, + + widest_int old_mask = m_mask; + m_mask = (m_mask | mask) | (m_value ^ value); ++ m_value &= value; + + if (wi::sext (m_mask, precision) == -1) + return set_to_bottom (); +--- /dev/null b/gcc/testsuite/gcc.dg/ipa/pr96482.c +@@ -0,0 +1,44 @@ ++/* PR ipa/96482 */ ++/* { dg-do run } */ ++/* { dg-options "-O2 -flto" } */ ++/* { dg-require-effective-target lto } */ ++ ++int ++__attribute__((noinline)) ++foo(int arg) ++{ ++ if (arg == 3) ++return 1; ++ if (arg == 4) ++return 123; ++ ++ __builtin_unreachable (); ++} ++ ++int ++__attribute__((noinline)) ++baz(int x) ++{ ++ if (x != 0) ++return foo(3); /* called */ ++ ++ return 1; ++} ++ ++int ++__attribute__((noinline)) ++bar(int x) ++{ ++ if (x == 0) ++return foo(5); /* not executed */ ++ ++ return 1; ++} ++ ++int main(int argc, char **argv) ++{ ++ if (bar(argc) != baz(argc)) ++__builtin_abort (); ++ ++ return 0; ++} +--- a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c +@@ -306,6 +306,9 @@ get_default_value (tree var) + { + val.lattice_val = CONSTANT; + val.value = value; ++widest_int ipa_value = wi::to_widest (value); ++/* Unknown bits from IPA CP must be equal to zero. */ ++gcc_assert (wi::bit_and (ipa_value, mask) == 0); + val.mask = mask; + if (nonzero_bits != -1) + val.mask &= extend_mask (nonzero_bits, +-- +2.28.0 + diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index 7cde6a3..49edda3 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -1,6 +1,7 @@ 2 TODO + 33_all_lto-O0-mix-ICE-ipa-PR96291.patch + 34_all_fundecl-I
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: 50322c7c5fb8f869f45f8dd23a89f4a7c4b8ba2d Author: Sergei Trofimovich gentoo org> AuthorDate: Thu Apr 8 19:36:03 2021 + Commit: Sergei Trofimovich gentoo org> CommitDate: Thu Apr 8 19:36:03 2021 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=50322c7c 10.2.0: revert "port binutils fix for CET detection on i486" The patch is not ready for prime time. Le't pull newer upstream version a bit later. This reverts commit 5600e4343f36e2a4925b09388d3ffe7400143b9f. Reported-by: Worx Bug: https://bugs.gentoo.org/777117 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/44_all_cet-i486.patch | 109 10.2.0/gentoo/README.history| 1 - 2 files changed, 110 deletions(-) diff --git a/10.2.0/gentoo/44_all_cet-i486.patch b/10.2.0/gentoo/44_all_cet-i486.patch deleted file mode 100644 index 956e439..000 --- a/10.2.0/gentoo/44_all_cet-i486.patch +++ /dev/null @@ -1,109 +0,0 @@ -https://bugs.gentoo.org/777117 - -From 267a609477624ade477994b24809a72eeb522ff1 Mon Sep 17 00:00:00 2001 -From: "H.J. Lu via Gcc-patches" -Date: Sun, 14 Feb 2021 09:26:40 -0800 -Subject: [PATCH 2/2] GCC_CET_HOST_FLAGS: Check if host supports multi-byte - NOPs - -Check if host supports multi-byte NOPs before enabling CET on host. - -config/ - - PR binutils/27397 - * cet.m4 (GCC_CET_HOST_FLAGS): Check if host supports multi-byte - NOPs. - -libiberty/ - - PR binutils/27397 - * configure: Regenerated. - - config/cet.m4 | 19 --- - libiberty/configure | 29 + - 2 files changed, 45 insertions(+), 3 deletions(-) - a/config/cet.m4 -+++ b/config/cet.m4 -@@ -130,6 +130,18 @@ fi - if test x$may_have_cet = xyes; then - if test x$cross_compiling = xno; then - AC_TRY_RUN([ -+int -+main () -+{ -+ asm ("endbr32"); -+ return 0; -+} -+], -+[have_multi_byte_nop=yes], -+[have_multi_byte_nop=no]) -+have_cet=no -+if test x$have_multi_byte_nop = xyes; then -+ AC_TRY_RUN([ - static void - foo (void) - { -@@ -155,9 +167,10 @@ main () - bar (); - return 0; - } --], --[have_cet=no], --[have_cet=yes]) -+ ], -+ [have_cet=no], -+ [have_cet=yes]) -+fi - if test x$enable_cet = xno -a x$have_cet = xyes; then - AC_MSG_ERROR([Intel CET must be enabled on Intel CET enabled host]) - fi a/libiberty/configure -+++ b/libiberty/configure -@@ -5396,6 +5396,34 @@ else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext - /* end confdefs.h. */ - -+int -+main () -+{ -+ asm ("endbr32"); -+ return 0; -+} -+ -+_ACEOF -+if ac_fn_c_try_run "$LINENO"; then : -+ have_multi_byte_nop=yes -+else -+ have_multi_byte_nop=no -+fi -+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ -+ conftest.$ac_objext conftest.beam conftest.$ac_ext -+fi -+ -+have_cet=no -+if test x$have_multi_byte_nop = xyes; then -+ if test "$cross_compiling" = yes; then : -+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -+as_fn_error $? "cannot run test program while cross compiling -+See \`config.log' for more details" "$LINENO" 5; } -+else -+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext -+/* end confdefs.h. */ -+ - static void - foo (void) - { -@@ -5432,6 +5460,7 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext - fi - -+fi - if test x$enable_cet = xno -a x$have_cet = xyes; then - as_fn_error $? "Intel CET must be enabled on Intel CET enabled host" "$LINENO" 5 - fi --- -2.31.0 - diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index f47a108..f195ae9 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -1,7 +1,6 @@ 7 TODO + 42_all_vmat-PR97236.patch + 43_all_vtv-slibtool.patch - + 44_all_cet-i486.patch 6 29 Dec 2020 - 34_all_fundecl-ICE-PR95820.patch
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: 5600e4343f36e2a4925b09388d3ffe7400143b9f Author: Sergei Trofimovich gentoo org> AuthorDate: Fri Mar 19 08:01:22 2021 + Commit: Sergei Trofimovich gentoo org> CommitDate: Fri Mar 19 08:01:22 2021 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=5600e434 10.2.0: port binutils fix for CET detection on i486 Reported-by: Worx Bug: https://bugs.gentoo.org/777117 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/44_all_cet-i486.patch | 109 10.2.0/gentoo/README.history| 1 + 2 files changed, 110 insertions(+) diff --git a/10.2.0/gentoo/44_all_cet-i486.patch b/10.2.0/gentoo/44_all_cet-i486.patch new file mode 100644 index 000..956e439 --- /dev/null +++ b/10.2.0/gentoo/44_all_cet-i486.patch @@ -0,0 +1,109 @@ +https://bugs.gentoo.org/777117 + +From 267a609477624ade477994b24809a72eeb522ff1 Mon Sep 17 00:00:00 2001 +From: "H.J. Lu via Gcc-patches" +Date: Sun, 14 Feb 2021 09:26:40 -0800 +Subject: [PATCH 2/2] GCC_CET_HOST_FLAGS: Check if host supports multi-byte + NOPs + +Check if host supports multi-byte NOPs before enabling CET on host. + +config/ + + PR binutils/27397 + * cet.m4 (GCC_CET_HOST_FLAGS): Check if host supports multi-byte + NOPs. + +libiberty/ + + PR binutils/27397 + * configure: Regenerated. + +--- + config/cet.m4 | 19 --- + libiberty/configure | 29 + + 2 files changed, 45 insertions(+), 3 deletions(-) + +--- a/config/cet.m4 b/config/cet.m4 +@@ -130,6 +130,18 @@ fi + if test x$may_have_cet = xyes; then + if test x$cross_compiling = xno; then + AC_TRY_RUN([ ++int ++main () ++{ ++ asm ("endbr32"); ++ return 0; ++} ++], ++[have_multi_byte_nop=yes], ++[have_multi_byte_nop=no]) ++have_cet=no ++if test x$have_multi_byte_nop = xyes; then ++ AC_TRY_RUN([ + static void + foo (void) + { +@@ -155,9 +167,10 @@ main () + bar (); + return 0; + } +-], +-[have_cet=no], +-[have_cet=yes]) ++ ], ++ [have_cet=no], ++ [have_cet=yes]) ++fi + if test x$enable_cet = xno -a x$have_cet = xyes; then + AC_MSG_ERROR([Intel CET must be enabled on Intel CET enabled host]) + fi +--- a/libiberty/configure b/libiberty/configure +@@ -5396,6 +5396,34 @@ else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ + ++int ++main () ++{ ++ asm ("endbr32"); ++ return 0; ++} ++ ++_ACEOF ++if ac_fn_c_try_run "$LINENO"; then : ++ have_multi_byte_nop=yes ++else ++ have_multi_byte_nop=no ++fi ++rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ ++ conftest.$ac_objext conftest.beam conftest.$ac_ext ++fi ++ ++have_cet=no ++if test x$have_multi_byte_nop = xyes; then ++ if test "$cross_compiling" = yes; then : ++ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 ++$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} ++as_fn_error $? "cannot run test program while cross compiling ++See \`config.log' for more details" "$LINENO" 5; } ++else ++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext ++/* end confdefs.h. */ ++ + static void + foo (void) + { +@@ -5432,6 +5460,7 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext + fi + ++fi + if test x$enable_cet = xno -a x$have_cet = xyes; then + as_fn_error $? "Intel CET must be enabled on Intel CET enabled host" "$LINENO" 5 + fi +-- +2.31.0 + diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index f195ae9..f47a108 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -1,6 +1,7 @@ 7 TODO + 42_all_vmat-PR97236.patch + 43_all_vtv-slibtool.patch + + 44_all_cet-i486.patch 6 29 Dec 2020 - 34_all_fundecl-ICE-PR95820.patch
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: 8634da04f3f6214cc36ebfeba38c4f3fca4473be Author: Sergei Trofimovich gentoo org> AuthorDate: Thu Mar 4 10:59:30 2021 + Commit: Sergei Trofimovich gentoo org> CommitDate: Thu Mar 4 10:59:30 2021 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=8634da04 10.2.0: backport PR97236: fix bad use of VMAT_CONTIGUOUS Bug: https://gcc.gnu.org/PR97236 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/42_all_vmat-PR97236.patch | 116 10.2.0/gentoo/README.history| 3 + 2 files changed, 119 insertions(+) diff --git a/10.2.0/gentoo/42_all_vmat-PR97236.patch b/10.2.0/gentoo/42_all_vmat-PR97236.patch new file mode 100644 index 000..5a7643c --- /dev/null +++ b/10.2.0/gentoo/42_all_vmat-PR97236.patch @@ -0,0 +1,116 @@ +https://gcc.gnu.org/PR97236 + +From 1ab88985631dd2c5a5e3b5c0dce47cf8b6ed2f82 Mon Sep 17 00:00:00 2001 +From: Matthias Klose +Date: Tue, 6 Oct 2020 13:41:37 +0200 +Subject: [PATCH] Backport fix for PR/tree-optimization/97236 - fix bad use of + VMAT_CONTIGUOUS + +This avoids using VMAT_CONTIGUOUS with single-element interleaving +when using V1mode vectors. Instead keep VMAT_ELEMENTWISE but +continue to avoid load-lanes and gathers. + +2020-10-01 Richard Biener + + PR tree-optimization/97236 + * tree-vect-stmts.c (get_group_load_store_type): Keep + VMAT_ELEMENTWISE for single-element vectors. + + * gcc.dg/vect/pr97236.c: New testcase. +--- + gcc/testsuite/gcc.dg/vect/pr97236.c | 43 + + gcc/tree-vect-stmts.c | 20 ++ + 2 files changed, 52 insertions(+), 11 deletions(-) + create mode 100644 gcc/testsuite/gcc.dg/vect/pr97236.c + +diff --git a/gcc/testsuite/gcc.dg/vect/pr97236.c b/gcc/testsuite/gcc.dg/vect/pr97236.c +new file mode 100644 +index 000..9d3dc20d953 +--- /dev/null b/gcc/testsuite/gcc.dg/vect/pr97236.c +@@ -0,0 +1,43 @@ ++typedef unsigned char __uint8_t; ++typedef __uint8_t uint8_t; ++typedef struct plane_t { ++ uint8_t *p_pixels; ++ int i_lines; ++ int i_pitch; ++} plane_t; ++ ++typedef struct { ++ plane_t p[5]; ++} picture_t; ++ ++#define N 4 ++ ++void __attribute__((noipa)) ++picture_Clone(picture_t *picture, picture_t *res) ++{ ++ for (int i = 0; i < N; i++) { ++res->p[i].p_pixels = picture->p[i].p_pixels; ++res->p[i].i_lines = picture->p[i].i_lines; ++res->p[i].i_pitch = picture->p[i].i_pitch; ++ } ++} ++ ++int ++main() ++{ ++ picture_t aaa, bbb; ++ uint8_t pixels[10] = {1, 1, 1, 1, 1, 1, 1, 1}; ++ ++ for (unsigned i = 0; i < N; i++) ++aaa.p[i].p_pixels = pixels; ++ ++ picture_Clone (&aaa, &bbb); ++ ++ uint8_t c = 0; ++ for (unsigned i = 0; i < N; i++) ++c += bbb.p[i].p_pixels[0]; ++ ++ if (c != N) ++__builtin_abort (); ++ return 0; ++} +diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c +index 9ace345fc5e..d8b2ff3d6ee 100644 +--- a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c +@@ -2413,25 +2413,23 @@ get_group_load_store_type (stmt_vec_info stmt_info, tree vectype, bool slp, + /* First cope with the degenerate case of a single-element +vector. */ + if (known_eq (TYPE_VECTOR_SUBPARTS (vectype), 1U)) +- *memory_access_type = VMAT_CONTIGUOUS; ++ ; + + /* Otherwise try using LOAD/STORE_LANES. */ +-if (*memory_access_type == VMAT_ELEMENTWISE +-&& (vls_type == VLS_LOAD +-? vect_load_lanes_supported (vectype, group_size, masked_p) +-: vect_store_lanes_supported (vectype, group_size, +- masked_p))) ++else if (vls_type == VLS_LOAD ++ ? vect_load_lanes_supported (vectype, group_size, masked_p) ++ : vect_store_lanes_supported (vectype, group_size, ++ masked_p)) + { + *memory_access_type = VMAT_LOAD_STORE_LANES; + overrun_p = would_overrun_p; + } + + /* If that fails, try using permuting loads. */ +-if (*memory_access_type == VMAT_ELEMENTWISE +-&& (vls_type == VLS_LOAD +-? vect_grouped_load_supported (vectype, single_element_p, +- group_size) +-: vect_grouped_store_supported (vectype, group_size))) ++else if (vls_type == VLS_LOAD ++ ? vect_grouped_load_supported (vectype, single_element_p, ++group_size) ++ : vect_grouped_store_supported (vectype, group_size)) + { + *memory_access_type = VMAT_CONTIGUOUS_PERMUTE; + overrun_p = would_overrun_p; +-- +2.30.1 + diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index 48587e1..4ca261a 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -1,3 +1,6 @
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: ff3a446afb9e0abb87869e85826454e85ef398c3 Author: Sergei Trofimovich gentoo org> AuthorDate: Mon Mar 15 22:55:21 2021 + Commit: Sergei Trofimovich gentoo org> CommitDate: Mon Mar 15 22:57:07 2021 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=ff3a446a 10.2.0: fix vtv build on slibtool Reported-by: orbea riseup.net Bug: https://gcc.gnu.org/PR99172 Bug: https://bugs.gentoo.org/767706 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/43_all_vtv-slibtool.patch | 62 + 10.2.0/gentoo/README.history| 1 + 2 files changed, 63 insertions(+) diff --git a/10.2.0/gentoo/43_all_vtv-slibtool.patch b/10.2.0/gentoo/43_all_vtv-slibtool.patch new file mode 100644 index 000..b5716f9 --- /dev/null +++ b/10.2.0/gentoo/43_all_vtv-slibtool.patch @@ -0,0 +1,62 @@ +https://bugs.gentoo.org/767706 +https://gcc.gnu.org/PR99172 + +From c2be82058fb40f3ae891c68d185ff53e07f14f45 Mon Sep 17 00:00:00 2001 +From: Caroline Tice +Date: Fri, 12 Mar 2021 07:34:36 -0800 +Subject: [PATCH] libstdc++-v3: Update VTV vars for libtool link commands + [PR99172] + +This fixes PR 99172 + +Currently when GCC is configured with --enable-vtable-verify, the +libstdc++-v3 Makefiles add "-fvtable-verify=std +-Wl,-u_vtable_map_vars_start,-u_vtable_map_vars_end" to libtool link +commands. The "-fvtable-verify=std" piece causes alternate versions of +libtool (such as slibtool) to fail, unable to find "-lvtv" (GNU +libtool just removes that piece). + +This patch updates the libstdc++-v3 Makefiles to not pass +"-fvtable-verify=std" to the libtool link commands. +--- + libstdc++-v3/src/Makefile.am | 4 +++- + libstdc++-v3/src/Makefile.in | 3 ++- + +--- a/libstdc++-v3/src/Makefile.am b/libstdc++-v3/src/Makefile.am +@@ -214,12 +214,14 @@ compatibility-condvar.o: compatibility-condvar.cc + # set this option because CONFIG_CXXFLAGS has to be after + # OPTIMIZE_CXXFLAGS on the compile line so that -O2 can be overridden + # as the occasion calls for it. +-AM_CXXFLAGS = \ ++AM_CXXFLAGS_PRE = \ + -std=gnu++98 \ + $(glibcxx_compiler_pic_flag) \ + $(XTEMPLATE_FLAGS) $(VTV_CXXFLAGS) \ + $(WARN_CXXFLAGS) $(OPTIMIZE_CXXFLAGS) $(CONFIG_CXXFLAGS) + ++AM_CXXFLAGS = $(filter-out -fvtable-verify=std,$(AM_CXXFLAGS_PRE)) ++ + # Libtool notes + + # 1) In general, libtool expects an argument such as `--tag=CXX' when +--- a/libstdc++-v3/src/Makefile.in b/libstdc++-v3/src/Makefile.in +@@ -578,12 +578,13 @@ libstdc___la_LINK = $(CXXLINK) $(libstdc___la_LDFLAGS) $(lt_host_flags) + # set this option because CONFIG_CXXFLAGS has to be after + # OPTIMIZE_CXXFLAGS on the compile line so that -O2 can be overridden + # as the occasion calls for it. +-AM_CXXFLAGS = \ ++AM_CXXFLAGS_PRE = \ + -std=gnu++98 \ + $(glibcxx_compiler_pic_flag) \ + $(XTEMPLATE_FLAGS) $(VTV_CXXFLAGS) \ + $(WARN_CXXFLAGS) $(OPTIMIZE_CXXFLAGS) $(CONFIG_CXXFLAGS) + ++AM_CXXFLAGS = $(filter-out -fvtable-verify=std,$(AM_CXXFLAGS_PRE)) + + # Libtool notes + +-- +2.30.2 + diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index 4ca261a..f195ae9 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -1,5 +1,6 @@ 7 TODO + 42_all_vmat-PR97236.patch + + 43_all_vtv-slibtool.patch 6 29 Dec 2020 - 34_all_fundecl-ICE-PR95820.patch
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: 0d98cab225ecb321bc18d894951bb2d3b7b45bd0 Author: Sergei Trofimovich gentoo org> AuthorDate: Mon Aug 17 21:26:01 2020 + Commit: Sergei Trofimovich gentoo org> CommitDate: Mon Aug 17 21:26:01 2020 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=0d98cab2 10.2.0: backport ipa-cp bit fix, part 2 (PR/96482) Reported-by: Johannes Hirte Bug: https://bugs.gentoo.org/736685 Bug: https://gcc.gnu.org/PR96482 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/36_all_ipa-fix-bit-CP-p2.patch | 80 10.2.0/gentoo/README.history | 1 + 2 files changed, 81 insertions(+) diff --git a/10.2.0/gentoo/36_all_ipa-fix-bit-CP-p2.patch b/10.2.0/gentoo/36_all_ipa-fix-bit-CP-p2.patch new file mode 100644 index 000..1183b57 --- /dev/null +++ b/10.2.0/gentoo/36_all_ipa-fix-bit-CP-p2.patch @@ -0,0 +1,80 @@ +https://bugs.gentoo.org/736685 +https://gcc.gnu.org/PR96482 + +From 4a2371497e9bed64aa4f46169127f3ea8e32e726 Mon Sep 17 00:00:00 2001 +From: Martin Liska +Date: Thu, 13 Aug 2020 09:38:41 +0200 +Subject: [PATCH] ipa: fix ICE in get_default_value + +The patch aligns code with ipcp_bits_lattice::set_to_constant +where we properly mask m_value with m_mask. The same should +be done here. + +gcc/ChangeLog: + + PR ipa/96482 + * ipa-cp.c (ipcp_bits_lattice::meet_with_1): Mask m_value + with m_mask. + +gcc/testsuite/ChangeLog: + + PR ipa/96482 + * gcc.dg/ipa/pr96482-2.c: New test. + +(cherry picked from commit f91770216eade83f068528c1e4f00e2ac3b23044) +--- + gcc/ipa-cp.c | 2 +- + gcc/testsuite/gcc.dg/ipa/pr96482-2.c | 33 + 2 files changed, 34 insertions(+), 1 deletion(-) + create mode 100644 gcc/testsuite/gcc.dg/ipa/pr96482-2.c + +--- a/gcc/ipa-cp.c b/gcc/ipa-cp.c +@@ -1047,7 +1047,7 @@ ipcp_bits_lattice::meet_with_1 (widest_int value, widest_int mask, + + widest_int old_mask = m_mask; + m_mask = (m_mask | mask) | (m_value ^ value); +- m_value &= value; ++ m_value &= ~m_mask; + + if (wi::sext (m_mask, precision) == -1) + return set_to_bottom (); +--- /dev/null b/gcc/testsuite/gcc.dg/ipa/pr96482-2.c +@@ -0,0 +1,33 @@ ++/* PR ipa/96482 */ ++/* { dg-do compile } */ ++/* { dg-options "-O2" } */ ++ ++int i2c_transfer(); ++void _dev_err(); ++ ++struct i2c_msg { ++ char bufaddr; ++ int adapterdev; ++} wdt87xx_i2c_xfer_client; ++ ++int wdt87xx_i2c_xfer_client_0, wdt87xx_i2c_xfer_rxdata, wdt87xx_get_string_str_idx; ++ ++void ++static wdt87xx_i2c_xfer(void *txdata, unsigned rxlen) { ++ struct i2c_msg msgs[] = {wdt87xx_i2c_xfer_client_0, rxlen, ++ wdt87xx_i2c_xfer_rxdata}; ++ int error = i2c_transfer(wdt87xx_i2c_xfer_client, msgs); ++ _dev_err("", __func__, error); ++} ++static void wdt87xx_get_string(unsigned len) { ++ char tx_buf[] = {wdt87xx_get_string_str_idx, 3}; ++ int rx_len = len + 2; ++ wdt87xx_i2c_xfer(tx_buf, rx_len); ++} ++ ++void ++wdt87xx_ts_probe_tx_buf() { ++ wdt87xx_get_string(34); ++ wdt87xx_get_string(8); ++ wdt87xx_i2c_xfer(wdt87xx_ts_probe_tx_buf, 2); ++} +-- +2.28.0 + diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index 49edda3..8be215b 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -2,6 +2,7 @@ + 33_all_lto-O0-mix-ICE-ipa-PR96291.patch + 34_all_fundecl-ICE-PR95820.patch + 35_all_ipa-fix-bit-CP.patch + + 36_all_ipa-fix-bit-CP-p2.patch 1 23 July 2020 + 01_all_default-fortify-source.patch
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: 9bba1f72a9210743fddf664b716b5cf288132922 Author: Sergei Trofimovich gentoo org> AuthorDate: Sun Aug 23 09:11:31 2020 + Commit: Sergei Trofimovich gentoo org> CommitDate: Sun Aug 23 09:11:31 2020 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=9bba1f72 10.2.0: cut 2 patchset Four new patches: + 33_all_lto-O0-mix-ICE-ipa-PR96291.patch: fix -O0 crash for ipa/lto + 34_all_fundecl-ICE-PR95820.patch: fix ICE on invalid templates + 35_all_ipa-fix-bit-CP.patch: fix bad code generation in ipa bit constprop + 36_all_ipa-fix-bit-CP-p2.patch: part 2 of previous patch Bug: https://bugs.gentoo.org/733482 Bug: https://gcc.gnu.org/PR96291 Bug: https://bugs.gentoo.org/730406 Bug: https://gcc.gnu.org/PR95820 Bug: https://bugs.gentoo.org/736685 Bug: https://gcc.gnu.org/PR96482 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/README.history | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index 8be215b..1bfe565 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -1,4 +1,4 @@ -2 TODO +2 23 Aug 2020 + 33_all_lto-O0-mix-ICE-ipa-PR96291.patch + 34_all_fundecl-ICE-PR95820.patch + 35_all_ipa-fix-bit-CP.patch
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: d6e1bf3168cce755396a408032b4804a7a527d43 Author: Sergei Trofimovich gentoo org> AuthorDate: Wed Nov 4 00:03:31 2020 + Commit: Sergei Trofimovich gentoo org> CommitDate: Wed Nov 4 07:26:02 2020 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=d6e1bf31 10.2.0: cut 4 patchset Single new patch: + 40_all_ipa-to_frequency.patch: fix ICE on empty profile merges. Bug: https://bugs.gentoo.org/746578 Bug: https://gcc.gnu.org/PR97295 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/README.history | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index e419e62..e0207e7 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -1,4 +1,4 @@ -4 TODO +4 04 Nov 2020 + 40_all_ipa-to_frequency.patch 3 02 Oct 2020
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: 7adab39a82fd07085f600603bdc5c440aa1c142a Author: Sergei Trofimovich gentoo org> AuthorDate: Tue Dec 29 09:51:52 2020 + Commit: Sergei Trofimovich gentoo org> CommitDate: Tue Dec 29 09:51:52 2020 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=7adab39a 10.2.0: revert PR95820 backporting The backport breaks parsing as seen in https://gcc.gnu.org/PR98441 Bug: https://gcc.gnu.org/PR95820 Bug: https://bugs.gentoo.org/730406 Reported-by: Daniel Santos Bug: https://gcc.gnu.org/PR98441 Bug: https://bugs.gentoo.org/762382 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/34_all_fundecl-ICE-PR95820.patch | 25 - 10.2.0/gentoo/README.history | 3 +++ 2 files changed, 3 insertions(+), 25 deletions(-) diff --git a/10.2.0/gentoo/34_all_fundecl-ICE-PR95820.patch b/10.2.0/gentoo/34_all_fundecl-ICE-PR95820.patch deleted file mode 100644 index e365420..000 --- a/10.2.0/gentoo/34_all_fundecl-ICE-PR95820.patch +++ /dev/null @@ -1,25 +0,0 @@ -It's an unofficial backport of PR95820 where gcc ICEs on -invalid syntax. As creduce frequently end up in these ICEs -as in #730406 let's backport it to gcc-10. - -https://gcc.gnu.org/PR95820 -https://bugs.gentoo.org/730406 a/gcc/cp/decl.c -+++ b/gcc/cp/decl.c -@@ -12029,14 +12029,11 @@ grokdeclarator (const cp_declarator *declarator, - - /* Handle a late-specified return type. */ - tree late_return_type = declarator->u.function.late_return_type; -- if (funcdecl_p -- /* This is the case e.g. for -- using T = auto () -> int. */ -- || inner_declarator == NULL) -+ if (true) - { - if (tree auto_node = type_uses_auto (type)) - { -- if (!late_return_type) -+ if (!late_return_type && funcdecl_p) - { - if (current_class_type - && LAMBDA_TYPE_P (current_class_type)) diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index 639805d..81678b5 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -1,3 +1,6 @@ +6 TODO + - 34_all_fundecl-ICE-PR95820.patch + 5 18 Dec 2020 + 41_all_strlen-PR96758.patch
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: e71e59c25315ebda3ebf4014bb108db9dda08a27 Author: Sergei Trofimovich gentoo org> AuthorDate: Fri Dec 18 20:57:44 2020 + Commit: Sergei Trofimovich gentoo org> CommitDate: Fri Dec 18 20:57:44 2020 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=e71e59c2 10.2.0: cut 5 patchset Single new patch: + 41_all_strlen-PR96758.patch: fix string comparison against literals Bug: https://bugs.gentoo.org/757792 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/README.history | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index 8b8c475..639805d 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -1,4 +1,4 @@ -5 TODO +5 18 Dec 2020 + 41_all_strlen-PR96758.patch 4 04 Nov 2020
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: 3779ee05e8c035d435c62198f3b761516e63fdf0 Author: Sergei Trofimovich gentoo org> AuthorDate: Tue Dec 29 10:05:50 2020 + Commit: Sergei Trofimovich gentoo org> CommitDate: Tue Dec 29 10:05:50 2020 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=3779ee05 10.2.0: cut 6 patchset Single dropped patch: - 34_all_fundecl-ICE-PR95820.patch: revert PR95820 backporting Bug: https://gcc.gnu.org/PR95820 Bug: https://bugs.gentoo.org/730406 Reported-by: Daniel Santos Bug: https://gcc.gnu.org/PR98441 Bug: https://bugs.gentoo.org/762382 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/README.history | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index 81678b5..48587e1 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -1,4 +1,4 @@ -6 TODO +6 29 Dec 2020 - 34_all_fundecl-ICE-PR95820.patch 5 18 Dec 2020
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: 8634da04f3f6214cc36ebfeba38c4f3fca4473be Author: Sergei Trofimovich gentoo org> AuthorDate: Thu Mar 4 10:59:30 2021 + Commit: Sergei Trofimovich gentoo org> CommitDate: Thu Mar 4 10:59:30 2021 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=8634da04 10.2.0: backport PR97236: fix bad use of VMAT_CONTIGUOUS Bug: https://gcc.gnu.org/PR97236 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/42_all_vmat-PR97236.patch | 116 10.2.0/gentoo/README.history| 3 + 2 files changed, 119 insertions(+) diff --git a/10.2.0/gentoo/42_all_vmat-PR97236.patch b/10.2.0/gentoo/42_all_vmat-PR97236.patch new file mode 100644 index 000..5a7643c --- /dev/null +++ b/10.2.0/gentoo/42_all_vmat-PR97236.patch @@ -0,0 +1,116 @@ +https://gcc.gnu.org/PR97236 + +From 1ab88985631dd2c5a5e3b5c0dce47cf8b6ed2f82 Mon Sep 17 00:00:00 2001 +From: Matthias Klose +Date: Tue, 6 Oct 2020 13:41:37 +0200 +Subject: [PATCH] Backport fix for PR/tree-optimization/97236 - fix bad use of + VMAT_CONTIGUOUS + +This avoids using VMAT_CONTIGUOUS with single-element interleaving +when using V1mode vectors. Instead keep VMAT_ELEMENTWISE but +continue to avoid load-lanes and gathers. + +2020-10-01 Richard Biener + + PR tree-optimization/97236 + * tree-vect-stmts.c (get_group_load_store_type): Keep + VMAT_ELEMENTWISE for single-element vectors. + + * gcc.dg/vect/pr97236.c: New testcase. +--- + gcc/testsuite/gcc.dg/vect/pr97236.c | 43 + + gcc/tree-vect-stmts.c | 20 ++ + 2 files changed, 52 insertions(+), 11 deletions(-) + create mode 100644 gcc/testsuite/gcc.dg/vect/pr97236.c + +diff --git a/gcc/testsuite/gcc.dg/vect/pr97236.c b/gcc/testsuite/gcc.dg/vect/pr97236.c +new file mode 100644 +index 000..9d3dc20d953 +--- /dev/null b/gcc/testsuite/gcc.dg/vect/pr97236.c +@@ -0,0 +1,43 @@ ++typedef unsigned char __uint8_t; ++typedef __uint8_t uint8_t; ++typedef struct plane_t { ++ uint8_t *p_pixels; ++ int i_lines; ++ int i_pitch; ++} plane_t; ++ ++typedef struct { ++ plane_t p[5]; ++} picture_t; ++ ++#define N 4 ++ ++void __attribute__((noipa)) ++picture_Clone(picture_t *picture, picture_t *res) ++{ ++ for (int i = 0; i < N; i++) { ++res->p[i].p_pixels = picture->p[i].p_pixels; ++res->p[i].i_lines = picture->p[i].i_lines; ++res->p[i].i_pitch = picture->p[i].i_pitch; ++ } ++} ++ ++int ++main() ++{ ++ picture_t aaa, bbb; ++ uint8_t pixels[10] = {1, 1, 1, 1, 1, 1, 1, 1}; ++ ++ for (unsigned i = 0; i < N; i++) ++aaa.p[i].p_pixels = pixels; ++ ++ picture_Clone (&aaa, &bbb); ++ ++ uint8_t c = 0; ++ for (unsigned i = 0; i < N; i++) ++c += bbb.p[i].p_pixels[0]; ++ ++ if (c != N) ++__builtin_abort (); ++ return 0; ++} +diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c +index 9ace345fc5e..d8b2ff3d6ee 100644 +--- a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c +@@ -2413,25 +2413,23 @@ get_group_load_store_type (stmt_vec_info stmt_info, tree vectype, bool slp, + /* First cope with the degenerate case of a single-element +vector. */ + if (known_eq (TYPE_VECTOR_SUBPARTS (vectype), 1U)) +- *memory_access_type = VMAT_CONTIGUOUS; ++ ; + + /* Otherwise try using LOAD/STORE_LANES. */ +-if (*memory_access_type == VMAT_ELEMENTWISE +-&& (vls_type == VLS_LOAD +-? vect_load_lanes_supported (vectype, group_size, masked_p) +-: vect_store_lanes_supported (vectype, group_size, +- masked_p))) ++else if (vls_type == VLS_LOAD ++ ? vect_load_lanes_supported (vectype, group_size, masked_p) ++ : vect_store_lanes_supported (vectype, group_size, ++ masked_p)) + { + *memory_access_type = VMAT_LOAD_STORE_LANES; + overrun_p = would_overrun_p; + } + + /* If that fails, try using permuting loads. */ +-if (*memory_access_type == VMAT_ELEMENTWISE +-&& (vls_type == VLS_LOAD +-? vect_grouped_load_supported (vectype, single_element_p, +- group_size) +-: vect_grouped_store_supported (vectype, group_size))) ++else if (vls_type == VLS_LOAD ++ ? vect_grouped_load_supported (vectype, single_element_p, ++group_size) ++ : vect_grouped_store_supported (vectype, group_size)) + { + *memory_access_type = VMAT_CONTIGUOUS_PERMUTE; + overrun_p = would_overrun_p; +-- +2.30.1 + diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index 48587e1..4ca261a 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -1,3 +1,6 @
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: d6e1bf3168cce755396a408032b4804a7a527d43 Author: Sergei Trofimovich gentoo org> AuthorDate: Wed Nov 4 00:03:31 2020 + Commit: Sergei Trofimovich gentoo org> CommitDate: Wed Nov 4 07:26:02 2020 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=d6e1bf31 10.2.0: cut 4 patchset Single new patch: + 40_all_ipa-to_frequency.patch: fix ICE on empty profile merges. Bug: https://bugs.gentoo.org/746578 Bug: https://gcc.gnu.org/PR97295 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/README.history | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index e419e62..e0207e7 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -1,4 +1,4 @@ -4 TODO +4 04 Nov 2020 + 40_all_ipa-to_frequency.patch 3 02 Oct 2020
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: 50322c7c5fb8f869f45f8dd23a89f4a7c4b8ba2d Author: Sergei Trofimovich gentoo org> AuthorDate: Thu Apr 8 19:36:03 2021 + Commit: Sergei Trofimovich gentoo org> CommitDate: Thu Apr 8 19:36:03 2021 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=50322c7c 10.2.0: revert "port binutils fix for CET detection on i486" The patch is not ready for prime time. Le't pull newer upstream version a bit later. This reverts commit 5600e4343f36e2a4925b09388d3ffe7400143b9f. Reported-by: Worx Bug: https://bugs.gentoo.org/777117 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/44_all_cet-i486.patch | 109 10.2.0/gentoo/README.history| 1 - 2 files changed, 110 deletions(-) diff --git a/10.2.0/gentoo/44_all_cet-i486.patch b/10.2.0/gentoo/44_all_cet-i486.patch deleted file mode 100644 index 956e439..000 --- a/10.2.0/gentoo/44_all_cet-i486.patch +++ /dev/null @@ -1,109 +0,0 @@ -https://bugs.gentoo.org/777117 - -From 267a609477624ade477994b24809a72eeb522ff1 Mon Sep 17 00:00:00 2001 -From: "H.J. Lu via Gcc-patches" -Date: Sun, 14 Feb 2021 09:26:40 -0800 -Subject: [PATCH 2/2] GCC_CET_HOST_FLAGS: Check if host supports multi-byte - NOPs - -Check if host supports multi-byte NOPs before enabling CET on host. - -config/ - - PR binutils/27397 - * cet.m4 (GCC_CET_HOST_FLAGS): Check if host supports multi-byte - NOPs. - -libiberty/ - - PR binutils/27397 - * configure: Regenerated. - - config/cet.m4 | 19 --- - libiberty/configure | 29 + - 2 files changed, 45 insertions(+), 3 deletions(-) - a/config/cet.m4 -+++ b/config/cet.m4 -@@ -130,6 +130,18 @@ fi - if test x$may_have_cet = xyes; then - if test x$cross_compiling = xno; then - AC_TRY_RUN([ -+int -+main () -+{ -+ asm ("endbr32"); -+ return 0; -+} -+], -+[have_multi_byte_nop=yes], -+[have_multi_byte_nop=no]) -+have_cet=no -+if test x$have_multi_byte_nop = xyes; then -+ AC_TRY_RUN([ - static void - foo (void) - { -@@ -155,9 +167,10 @@ main () - bar (); - return 0; - } --], --[have_cet=no], --[have_cet=yes]) -+ ], -+ [have_cet=no], -+ [have_cet=yes]) -+fi - if test x$enable_cet = xno -a x$have_cet = xyes; then - AC_MSG_ERROR([Intel CET must be enabled on Intel CET enabled host]) - fi a/libiberty/configure -+++ b/libiberty/configure -@@ -5396,6 +5396,34 @@ else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext - /* end confdefs.h. */ - -+int -+main () -+{ -+ asm ("endbr32"); -+ return 0; -+} -+ -+_ACEOF -+if ac_fn_c_try_run "$LINENO"; then : -+ have_multi_byte_nop=yes -+else -+ have_multi_byte_nop=no -+fi -+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ -+ conftest.$ac_objext conftest.beam conftest.$ac_ext -+fi -+ -+have_cet=no -+if test x$have_multi_byte_nop = xyes; then -+ if test "$cross_compiling" = yes; then : -+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -+as_fn_error $? "cannot run test program while cross compiling -+See \`config.log' for more details" "$LINENO" 5; } -+else -+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext -+/* end confdefs.h. */ -+ - static void - foo (void) - { -@@ -5432,6 +5460,7 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext - fi - -+fi - if test x$enable_cet = xno -a x$have_cet = xyes; then - as_fn_error $? "Intel CET must be enabled on Intel CET enabled host" "$LINENO" 5 - fi --- -2.31.0 - diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index f47a108..f195ae9 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -1,7 +1,6 @@ 7 TODO + 42_all_vmat-PR97236.patch + 43_all_vtv-slibtool.patch - + 44_all_cet-i486.patch 6 29 Dec 2020 - 34_all_fundecl-ICE-PR95820.patch
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: 5600e4343f36e2a4925b09388d3ffe7400143b9f Author: Sergei Trofimovich gentoo org> AuthorDate: Fri Mar 19 08:01:22 2021 + Commit: Sergei Trofimovich gentoo org> CommitDate: Fri Mar 19 08:01:22 2021 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=5600e434 10.2.0: port binutils fix for CET detection on i486 Reported-by: Worx Bug: https://bugs.gentoo.org/777117 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/44_all_cet-i486.patch | 109 10.2.0/gentoo/README.history| 1 + 2 files changed, 110 insertions(+) diff --git a/10.2.0/gentoo/44_all_cet-i486.patch b/10.2.0/gentoo/44_all_cet-i486.patch new file mode 100644 index 000..956e439 --- /dev/null +++ b/10.2.0/gentoo/44_all_cet-i486.patch @@ -0,0 +1,109 @@ +https://bugs.gentoo.org/777117 + +From 267a609477624ade477994b24809a72eeb522ff1 Mon Sep 17 00:00:00 2001 +From: "H.J. Lu via Gcc-patches" +Date: Sun, 14 Feb 2021 09:26:40 -0800 +Subject: [PATCH 2/2] GCC_CET_HOST_FLAGS: Check if host supports multi-byte + NOPs + +Check if host supports multi-byte NOPs before enabling CET on host. + +config/ + + PR binutils/27397 + * cet.m4 (GCC_CET_HOST_FLAGS): Check if host supports multi-byte + NOPs. + +libiberty/ + + PR binutils/27397 + * configure: Regenerated. + +--- + config/cet.m4 | 19 --- + libiberty/configure | 29 + + 2 files changed, 45 insertions(+), 3 deletions(-) + +--- a/config/cet.m4 b/config/cet.m4 +@@ -130,6 +130,18 @@ fi + if test x$may_have_cet = xyes; then + if test x$cross_compiling = xno; then + AC_TRY_RUN([ ++int ++main () ++{ ++ asm ("endbr32"); ++ return 0; ++} ++], ++[have_multi_byte_nop=yes], ++[have_multi_byte_nop=no]) ++have_cet=no ++if test x$have_multi_byte_nop = xyes; then ++ AC_TRY_RUN([ + static void + foo (void) + { +@@ -155,9 +167,10 @@ main () + bar (); + return 0; + } +-], +-[have_cet=no], +-[have_cet=yes]) ++ ], ++ [have_cet=no], ++ [have_cet=yes]) ++fi + if test x$enable_cet = xno -a x$have_cet = xyes; then + AC_MSG_ERROR([Intel CET must be enabled on Intel CET enabled host]) + fi +--- a/libiberty/configure b/libiberty/configure +@@ -5396,6 +5396,34 @@ else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ + ++int ++main () ++{ ++ asm ("endbr32"); ++ return 0; ++} ++ ++_ACEOF ++if ac_fn_c_try_run "$LINENO"; then : ++ have_multi_byte_nop=yes ++else ++ have_multi_byte_nop=no ++fi ++rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ ++ conftest.$ac_objext conftest.beam conftest.$ac_ext ++fi ++ ++have_cet=no ++if test x$have_multi_byte_nop = xyes; then ++ if test "$cross_compiling" = yes; then : ++ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 ++$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} ++as_fn_error $? "cannot run test program while cross compiling ++See \`config.log' for more details" "$LINENO" 5; } ++else ++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext ++/* end confdefs.h. */ ++ + static void + foo (void) + { +@@ -5432,6 +5460,7 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext + fi + ++fi + if test x$enable_cet = xno -a x$have_cet = xyes; then + as_fn_error $? "Intel CET must be enabled on Intel CET enabled host" "$LINENO" 5 + fi +-- +2.31.0 + diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index f195ae9..f47a108 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -1,6 +1,7 @@ 7 TODO + 42_all_vmat-PR97236.patch + 43_all_vtv-slibtool.patch + + 44_all_cet-i486.patch 6 29 Dec 2020 - 34_all_fundecl-ICE-PR95820.patch
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: bb00f570a7d3f1d0e4233f8d353fb9c56f3a55cc Author: Sergei Trofimovich gentoo org> AuthorDate: Thu Sep 10 21:37:36 2020 + Commit: Sergei Trofimovich gentoo org> CommitDate: Thu Sep 10 21:37:36 2020 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=bb00f570 10.2.0: fix TOPN counters when logged from shared library The change does not yet fix underlying problem of recursive inliner. Bug: https://gcc.gnu.org/PR96913 Bug: https://gcc.gnu.org/PR96394 Bug: https://bugs.gentoo.org/734006 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/38_all_gcov-TOPN-PR96913.patch | 42 10.2.0/gentoo/README.history | 1 + 2 files changed, 43 insertions(+) diff --git a/10.2.0/gentoo/38_all_gcov-TOPN-PR96913.patch b/10.2.0/gentoo/38_all_gcov-TOPN-PR96913.patch new file mode 100644 index 000..5c301e4 --- /dev/null +++ b/10.2.0/gentoo/38_all_gcov-TOPN-PR96913.patch @@ -0,0 +1,42 @@ +https://gcc.gnu.org/PR96913 +https://gcc.gnu.org/PR96394 +https://bugs.gentoo.org/734006 + +From ae887148e112e018bec0bab5bc15e53f2225037a Mon Sep 17 00:00:00 2001 +From: Sergei Trofimovich +Date: Sun, 6 Sep 2020 12:13:54 +0100 +Subject: [PATCH] gcov: fix TOPN streaming from shared libraries + +Before the change gcc did not stream correctly TOPN counters +if counters belonged to a non-local shared object. + +As a result zero-section optimization generated TOPN sections +in a form not recognizable by '__gcov_merge_topn'. + +The problem happens because in a case of multiple shared objects +'__gcov_merge_topn' function is present in address space multiple +times (once per each object). + +The fix is to never rely on function address and predicate on TOPN +counter types. + +libgcc/ChangeLog: + + PR gcov-profile/96913 + * libgcov-driver.c (write_one_data): Avoid function pointer + comparison in TOP streaming decision. +--- + libgcc/libgcov-driver.c | 7 ++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +--- a/libgcc/libgcov-driver.c b/libgcc/libgcov-driver.c +@@ -242,7 +242,7 @@ prune_counters (struct gcov_info *gi) + if (gi->merge[j] == NULL) + continue; + +-if (gi->merge[j] == __gcov_merge_topn) ++if (j == GCOV_COUNTER_V_TOPN || j == GCOV_COUNTER_V_INDIR) + { + gcc_assert (!(ci->num % GCOV_TOPN_VALUES_COUNTERS)); + for (unsigned k = 0; k < (ci->num / GCOV_TOPN_VALUES_COUNTERS); diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index 3fbcbfd..6d00c5a 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -1,6 +1,7 @@ 3 TODO U 28_all_EXTRA_OPTIONS-fstack-clash-protection.patch + 37_all_c-vector-init-PR96377.patch + + 38_all_gcov-TOPN-PR96913.patch 2 23 Aug 2020 + 33_all_lto-O0-mix-ICE-ipa-PR96291.patch
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: 064908a8c0b537e980721c7996d276e1901924db Author: Sergei Trofimovich gentoo org> AuthorDate: Thu Jul 23 08:15:06 2020 + Commit: Sergei Trofimovich gentoo org> CommitDate: Thu Jul 23 08:15:06 2020 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=064908a8 10.2.0: cut 1 patchset Based on gcc-10.1.0 patchset. The only change is upstreamed backportes: - 29_all_fix-float-hang-PR95118.patch - 31_all_ctor-range-PR95241.patch - 33_all_avx512-scalar-PR95528.patch - 34_all_cet-cross-x86.patch - 35_all_ICE-array-subscript-PR95508.patch - 38_all_ICE-ipa-fnsummary-PR96130.patch Bug: https://gcc.gnu.org/PR96190 Bug: https://bugs.gentoo.org/619706 Bug: https://gcc.gnu.org/PR96130 Bug: https://bugs.gentoo.org/733246 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/01_all_default-fortify-source.patch | 22 .../02_all_default-warn-format-security.patch | 22 .../gentoo/03_all_default-warn-trampolines.patch | 13 ++ 10.2.0/gentoo/04_all_nossp-on-nostdlib.patch | 27 10.2.0/gentoo/05_all_alpha-mieee-default.patch | 39 ++ 10.2.0/gentoo/06_all_ia64_note.GNU-stack.patch | 92 + .../gentoo/07_all_i386_libgcc_note.GNU-stack.patch | 54 10.2.0/gentoo/08_all_libiberty-asprintf.patch | 18 +++ 10.2.0/gentoo/09_all_libiberty-pic.patch | 10 ++ 10.2.0/gentoo/10_all_nopie-all-flags.patch | 18 +++ 10.2.0/gentoo/11_all_sh-drop-sysroot-suffix.patch | 32 + 10.2.0/gentoo/12_all_ia64-TEXTREL.patch| 22 .../gentoo/13_all_disable-systemtap-switch.patch | 122 ++ 10.2.0/gentoo/14_all_m68k-textrel-on-libgcc.patch | 93 ++ 10.2.0/gentoo/15_all_respect-build-cxxflags.patch | 39 ++ 10.2.0/gentoo/16_all_libgfortran-Werror.patch | 20 +++ 10.2.0/gentoo/17_all_libgomp-Werror.patch | 20 +++ 10.2.0/gentoo/18_all_libitm-Werror.patch | 19 +++ 10.2.0/gentoo/19_all_libatomic-Werror.patch| 19 +++ 10.2.0/gentoo/20_all_libbacktrace-Werror.patch | 17 +++ 10.2.0/gentoo/21_all_libsanitizer-Werror.patch | 17 +++ 10.2.0/gentoo/22_all_libstdcxx-no-vtv.patch| 61 + 10.2.0/gentoo/23_all_disable-riscv32-ABIs.patch| 53 10.2.0/gentoo/24_all_default_ssp-buffer-size.patch | 14 ++ 10.2.0/gentoo/25_all_hppa-faster-synth_mult.patch | 44 +++ 10.2.0/gentoo/26_all_libcpp-ar.patch | 143 + 10.2.0/gentoo/27_all_EXTRA_OPTIONS-z-now.patch | 26 ...all_EXTRA_OPTIONS-fstack-clash-protection.patch | 65 ++ .../29_all_lto-intl-workaround-PR95194.patch | 20 +++ 10.2.0/gentoo/30_all_plugin-objdump.patch | 34 + 10.2.0/gentoo/31_all_fno-delayed-branch.patch | 40 ++ 10.2.0/gentoo/32_all_sparc_pie_TEXTREL.patch | 49 +++ 10.2.0/gentoo/README.history | 33 + 33 files changed, 1317 insertions(+) diff --git a/10.2.0/gentoo/01_all_default-fortify-source.patch b/10.2.0/gentoo/01_all_default-fortify-source.patch new file mode 100644 index 000..d307474 --- /dev/null +++ b/10.2.0/gentoo/01_all_default-fortify-source.patch @@ -0,0 +1,22 @@ +Taken Debian's patch and removed docs matches: +https://salsa.debian.org/toolchain-team/gcc.git +Also see https://bugs.gentoo.org/621036 where +initially Gentoo used too complicated macro. + +# DP: Turn on -D_FORTIFY_SOURCE=2 by default for C, C++, ObjC, ObjC++, +# DP: if the optimization level is > 0 +--- a/gcc/c-family/c-cppbuiltin.c b/gcc/c-family/c-cppbuiltin.c +@@ -951,6 +951,12 @@ c_cpp_builtins (cpp_reader *pfile) + builtin_define_with_value ("__REGISTER_PREFIX__", REGISTER_PREFIX, 0); + builtin_define_with_value ("__USER_LABEL_PREFIX__", user_label_prefix, 0); + ++#if !defined(ACCEL_COMPILER) ++ /* Fortify Source enabled by default for optimization levels > 0 */ ++ if (optimize) ++builtin_define_with_int_value ("_FORTIFY_SOURCE", 2); ++#endif ++ + /* Misc. */ + if (flag_gnu89_inline) + cpp_define (pfile, "__GNUC_GNU_INLINE__"); diff --git a/10.2.0/gentoo/02_all_default-warn-format-security.patch b/10.2.0/gentoo/02_all_default-warn-format-security.patch new file mode 100644 index 000..f809abd --- /dev/null +++ b/10.2.0/gentoo/02_all_default-warn-format-security.patch @@ -0,0 +1,22 @@ +Enable -Wformat and -Wformat-security by default. + +--- a/gcc/c-family/c.opt 2016-03-23 18:51:56.0 +0100 b/gcc/c-family/c.opt 2016-04-28 23:45:54.063351272 +0200 +@@ -459,7 +459,7 @@ C ObjC C++ ObjC++ Var(warn_format_nonlit + Warn about format strings that are not literals. + + Wformat-security +-C ObjC C++ ObjC++ Var(warn_format_security) Warning LangEnabledBy(C ObjC C++ ObjC++,Wformat=, warn_format >= 2, 0) ++C ObjC C++ ObjC++ Var(warn_format_security) Init(1) Warning LangEnabledBy(C ObjC C++ ObjC++,Wformat=, warn_format >= 2, 0) + Warn about possible security problems
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: 8f9b6cda0cd772b5155d52a5effabd04fd656a18 Author: Sergei Trofimovich gentoo org> AuthorDate: Sun Jul 26 10:34:45 2020 + Commit: Sergei Trofimovich gentoo org> CommitDate: Sun Jul 26 10:34:45 2020 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=8f9b6cda 10.2.0: fix IPA ICE on LTO -O0/-O2 mix Bug: https://bugs.gentoo.org/733482 Bug: https://gcc.gnu.org/PR96291 Signed-off-by: Sergei Trofimovich gentoo.org> .../gentoo/33_all_lto-O0-mix-ICE-ipa-PR96291.patch | 46 ++ 10.2.0/gentoo/README.history | 3 ++ 2 files changed, 49 insertions(+) diff --git a/10.2.0/gentoo/33_all_lto-O0-mix-ICE-ipa-PR96291.patch b/10.2.0/gentoo/33_all_lto-O0-mix-ICE-ipa-PR96291.patch new file mode 100644 index 000..b163721 --- /dev/null +++ b/10.2.0/gentoo/33_all_lto-O0-mix-ICE-ipa-PR96291.patch @@ -0,0 +1,46 @@ +https://bugs.gentoo.org/733482 +https://gcc.gnu.org/PR96291 + +From 03810b1b2dec00575b2bcb579eb3d7c34bd176bc Mon Sep 17 00:00:00 2001 +From: Sergei Trofimovich +Date: Sat, 25 Jul 2020 19:26:50 +0100 +Subject: [PATCH] ipa/96291: don't crash on unoptimized lto functions + +In PR ipa/96291 the test contained an SCC with one +unoptimized function. This tricked ipa-cp into NULL dereference. + +has_undead_caller_from_outside_scc_p() did not take into account +that unoptimized funtions don't have IPA summary analysis. and +dereferenced NULL pointer causing an ICE. + + PR ipa/96291 + * ipa-cp.c (has_undead_caller_from_outside_scc_p): Consider + unoptimized callers as undead. +--- + gcc/ipa-cp.c | 12 +--- + 1 file changed, 9 insertions(+), 3 deletions(-) + +--- a/gcc/ipa-cp.c b/gcc/ipa-cp.c +@@ -5666,9 +5666,15 @@ has_undead_caller_from_outside_scc_p (struct cgraph_node *node, + && cs->caller->call_for_symbol_thunks_and_aliases + (has_undead_caller_from_outside_scc_p, NULL, true)) + return true; +-else if (!ipa_edge_within_scc (cs) +- && !IPA_NODE_REF (cs->caller)->node_dead) +- return true; ++else if (!ipa_edge_within_scc (cs)) ++ { ++ /* Unoptimized callers don't have IPA information. ++ Conservatively assume callers are undead. */ ++ if (!IPA_NODE_REF (cs->caller)) ++return true; ++ if (!IPA_NODE_REF (cs->caller)->node_dead) ++return true; ++ } + return false; + } + +-- +2.27.0 + diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index 4009f39..1c0fff9 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -1,3 +1,6 @@ +2 TODO + + 33_all_lto-O0-mix-ICE-ipa-PR96291.patch + 1 23 July 2020 + 01_all_default-fortify-source.patch + 02_all_default-warn-format-security.patch
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: fafbb4148cb5c2cf7e1ae02679240cba43e95992 Author: Sergei Trofimovich gentoo org> AuthorDate: Mon Jul 27 06:48:54 2020 + Commit: Sergei Trofimovich gentoo org> CommitDate: Mon Jul 27 06:48:54 2020 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=fafbb414 10.2.0: backport ICE on invalid function declarations Reported-by: Jack Ostroff Bug: https://bugs.gentoo.org/730406 Bug: https://gcc.gnu.org/PR95820 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/34_all_fundecl-ICE-PR95820.patch | 25 + 10.2.0/gentoo/README.history | 1 + 2 files changed, 26 insertions(+) diff --git a/10.2.0/gentoo/34_all_fundecl-ICE-PR95820.patch b/10.2.0/gentoo/34_all_fundecl-ICE-PR95820.patch new file mode 100644 index 000..e365420 --- /dev/null +++ b/10.2.0/gentoo/34_all_fundecl-ICE-PR95820.patch @@ -0,0 +1,25 @@ +It's an unofficial backport of PR95820 where gcc ICEs on +invalid syntax. As creduce frequently end up in these ICEs +as in #730406 let's backport it to gcc-10. + +https://gcc.gnu.org/PR95820 +https://bugs.gentoo.org/730406 +--- a/gcc/cp/decl.c b/gcc/cp/decl.c +@@ -12029,14 +12029,11 @@ grokdeclarator (const cp_declarator *declarator, + + /* Handle a late-specified return type. */ + tree late_return_type = declarator->u.function.late_return_type; +- if (funcdecl_p +- /* This is the case e.g. for +- using T = auto () -> int. */ +- || inner_declarator == NULL) ++ if (true) + { + if (tree auto_node = type_uses_auto (type)) + { +- if (!late_return_type) ++ if (!late_return_type && funcdecl_p) + { + if (current_class_type + && LAMBDA_TYPE_P (current_class_type)) diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index 1c0fff9..7cde6a3 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -1,5 +1,6 @@ 2 TODO + 33_all_lto-O0-mix-ICE-ipa-PR96291.patch + + 34_all_fundecl-ICE-PR95820.patch 1 23 July 2020 + 01_all_default-fortify-source.patch
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: bb31009f6bb62d2dbee6a4be9605c9286ef0df23 Author: Sergei Trofimovich gentoo org> AuthorDate: Thu Oct 15 17:30:51 2020 + Commit: Sergei Trofimovich gentoo org> CommitDate: Thu Oct 15 17:30:51 2020 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=bb31009f 10.2.0: backport IPA to_frequency() ICE Reported-by: inasprecali disroot.org Bug: https://bugs.gentoo.org/746578 Bug: https://gcc.gnu.org/PR97295 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/40_all_ipa-to_frequency.patch | 48 + 10.2.0/gentoo/README.history| 3 ++ 2 files changed, 51 insertions(+) diff --git a/10.2.0/gentoo/40_all_ipa-to_frequency.patch b/10.2.0/gentoo/40_all_ipa-to_frequency.patch new file mode 100644 index 000..0849207 --- /dev/null +++ b/10.2.0/gentoo/40_all_ipa-to_frequency.patch @@ -0,0 +1,48 @@ +https://bugs.gentoo.org/746578 +https://gcc.gnu.org/PR97295 + +From 508e2d88a4c512e8b8685cf5ba201ad48e6bb58d Mon Sep 17 00:00:00 2001 +From: Martin Liska +Date: Tue, 13 Oct 2020 16:44:47 +0200 +Subject: [PATCH] IPA: fix profile handling in IRA + +gcc/ChangeLog: + + PR ipa/97295 + * profile-count.c (profile_count::to_frequency): Move part of + gcc_assert to STATIC_ASSERT. + * regs.h (REG_FREQ_FROM_BB): Do not use count.to_frequency for + a function that does not have count_max initialized. +--- + gcc/profile-count.c | 4 ++-- + gcc/regs.h | 3 ++- + 2 files changed, 4 insertions(+), 3 deletions(-) + +--- a/gcc/profile-count.c b/gcc/profile-count.c +@@ -270,8 +270,8 @@ profile_count::to_frequency (struct function *fun) const + return BB_FREQ_MAX; + if (*this == zero ()) + return 0; +- gcc_assert (REG_BR_PROB_BASE == BB_FREQ_MAX +-&& fun->cfg->count_max.initialized_p ()); ++ STATIC_ASSERT (REG_BR_PROB_BASE == BB_FREQ_MAX); ++ gcc_assert (fun->cfg->count_max.initialized_p ()); + profile_probability prob = probability_in (fun->cfg->count_max); + if (!prob.initialized_p ()) + return REG_BR_PROB_BASE; +--- a/gcc/regs.h b/gcc/regs.h +@@ -128,7 +128,8 @@ extern size_t reg_info_p_size; +or profile driven feedback is available and the function is never executed, +frequency is always equivalent. Otherwise rescale the basic block +frequency. */ +-#define REG_FREQ_FROM_BB(bb) (optimize_function_for_size_p (cfun) \ ++#define REG_FREQ_FROM_BB(bb) ((optimize_function_for_size_p (cfun) \ ++ || !cfun->cfg->count_max.initialized_p ()) \ + ? REG_FREQ_MAX \ + : ((bb)->count.to_frequency (cfun) \ + * REG_FREQ_MAX / BB_FREQ_MAX) \ +-- +2.28.0 + diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index 86f3aae..e419e62 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -1,3 +1,6 @@ +4 TODO + + 40_all_ipa-to_frequency.patch + 3 02 Oct 2020 U 28_all_EXTRA_OPTIONS-fstack-clash-protection.patch + 37_all_c-vector-init-PR96377.patch
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: 7bf989ed8b53a13de6a6551b7f346b1dcadf5966 Author: Sergei Trofimovich gentoo org> AuthorDate: Fri Oct 2 09:12:10 2020 + Commit: Sergei Trofimovich gentoo org> CommitDate: Fri Oct 2 09:12:10 2020 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=7bf989ed 10.2.0: fix multiple speculation resolution on prog builds Reported-by: Ștefan Talpalaru Bug: https://gcc.gnu.org/PR96394 Bug: https://bugs.gentoo.org/734006 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/39_all_ipa-prop-multispec.patch | 150 ++ 10.2.0/gentoo/README.history | 1 + 2 files changed, 151 insertions(+) diff --git a/10.2.0/gentoo/39_all_ipa-prop-multispec.patch b/10.2.0/gentoo/39_all_ipa-prop-multispec.patch new file mode 100644 index 000..6e19992 --- /dev/null +++ b/10.2.0/gentoo/39_all_ipa-prop-multispec.patch @@ -0,0 +1,150 @@ +https://gcc.gnu.org/PR96394 +https://bugs.gentoo.org/734006 + +From 7f790f414ec38581b9bb033ab64e4ad12b9f8a4c Mon Sep 17 00:00:00 2001 +From: Martin Jambor +Date: Thu, 1 Oct 2020 19:39:27 +0200 +Subject: [PATCH] ipa-prop: Fix multiple-target speculation resolution + +Hi, + +as the FIXME which this patch removes states, the current code does +not work when a call with multiple speculative targets gets resolved +through parameter tracking during inlining - it feeds the inliner an +edge it has already dealt with. The patch makes the code which should +prevent it aware of the possibility that that speculation can have +more than one target now. + +Bootstrapped and tested and LTO bootstrapped on x86_64-linux. I did not +try profiled LTO bootstrap because it fails even without the patch (even +without Ada, just C, C++ and Fortran, at least commit 92f0d3d03a7 does). +OK for trunk? + +Thanks, + +Martin + +gcc/ChangeLog: + +2020-09-30 Martin Jambor + + PR ipa/96394 + * ipa-prop.c (update_indirect_edges_after_inlining): Do not add + resolved speculation edges to vector of new direct edges even in + presence of multiple speculative direct edges for a single call. + +gcc/testsuite/ChangeLog: + +2020-09-30 Martin Jambor + + PR ipa/96394 + * gcc.dg/tree-prof/pr96394.c: New test. +--- + gcc/ipa-prop.c | 10 ++-- + gcc/testsuite/gcc.dg/tree-prof/pr96394.c | 64 + 2 files changed, 70 insertions(+), 4 deletions(-) + create mode 100644 gcc/testsuite/gcc.dg/tree-prof/pr96394.c + +diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c +index ea88fd3fd95..0ff04d344e1 100644 +--- a/gcc/ipa-prop.c b/gcc/ipa-prop.c +@@ -3787,11 +3787,13 @@ update_indirect_edges_after_inlining (struct cgraph_edge *cs, + + param_index = ici->param_index; + jfunc = ipa_get_ith_jump_func (top, param_index); +- cgraph_node *spec_target = NULL; + +- /* FIXME: This may need updating for multiple calls. */ ++ auto_vec spec_targets; + if (ie->speculative) +- spec_target = ie->first_speculative_call_target ()->callee; ++ for (cgraph_edge *direct = ie->first_speculative_call_target (); ++ direct; ++ direct = direct->next_speculative_call_target ()) ++spec_targets.safe_push (direct->callee); + + if (!opt_for_fn (node->decl, flag_indirect_inlining)) + new_direct_edge = NULL; +@@ -3814,7 +3816,7 @@ update_indirect_edges_after_inlining (struct cgraph_edge *cs, + + /* If speculation was removed, then we need to do nothing. */ + if (new_direct_edge && new_direct_edge != ie +-&& new_direct_edge->callee == spec_target) ++&& spec_targets.contains (new_direct_edge->callee)) + { + new_direct_edge->indirect_inlining_edge = 1; + top = IPA_EDGE_REF (cs); +diff --git a/gcc/testsuite/gcc.dg/tree-prof/pr96394.c b/gcc/testsuite/gcc.dg/tree-prof/pr96394.c +new file mode 100644 +index 000..4280182a7c3 +--- /dev/null b/gcc/testsuite/gcc.dg/tree-prof/pr96394.c +@@ -0,0 +1,64 @@ ++/* PR ipa/96394 */ ++/* { dg-options "-O2" } */ ++ ++typedef struct _entry { ++int has_next; ++int next_ix; ++int count; ++} entry; ++ ++extern entry table[]; ++ ++void * ++__attribute__((noipa)) ++PyErr_Format(entry * e){ return 0; } ++ ++void ae(entry *); ++int h(entry *); ++int ap(entry *); ++int ag(entry *); ++ ++int ag(entry *j) { ++ if (j->has_next) ++h(&table[j->next_ix]); ++ return 0; ++} ++static int ai(entry *j, int k(entry *), int l, int m) { ++ int am = 1; ++ int ab; ++ ++ /* k is either 'h' or 'ap': 50%/50% */ ++ ab = k(j); ++ ++ /* loop never gets executed on real data */ ++ for (; j->count >= 2; am += 2) ++if (l) { ++ entry *i = &table[am + m]; ++ PyErr_Format(i); ++} ++ return ab; ++} ++void ++__attribute__((noipa)) ++bug() { ++ h(table); ++ h(table); ++} ++int h(entry *j) { return ai(j, ap, 4, 5); } ++int ap(entry *j) { return ai(j, ag, 14, 4); } ++ ++int main(void) ++{ ++bug(); ++} ++ ++entry
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: b4972ce62b04aafc6061836a92f0cebbadd80d7a Author: Sergei Trofimovich gentoo org> AuthorDate: Fri Oct 2 09:22:40 2020 + Commit: Sergei Trofimovich gentoo org> CommitDate: Fri Oct 2 09:22:40 2020 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=b4972ce6 10.2.0: cut 3 patchset three new patches: + 37_all_c-vector-init-PR96377.patch: fix vector init on arm + 38_all_gcov-TOPN-PR96913.patch: fix TOPN prof counters in shared libraries + 39_all_ipa-prop-multispec.patch: fix multiple speculation resolution on prof builds Bug: https://gcc.gnu.org/PR96377 Bug: https://gcc.gnu.org/PR96913 Bug: https://bugs.gentoo.org/734006 Bug: https://gcc.gnu.org/PR96394 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/README.history | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index 5929aae..86f3aae 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -1,4 +1,4 @@ -3 TODO +3 02 Oct 2020 U 28_all_EXTRA_OPTIONS-fstack-clash-protection.patch + 37_all_c-vector-init-PR96377.patch + 38_all_gcov-TOPN-PR96913.patch
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: 9b342fdeb8588681bb106e072cefd481a045fb21 Author: Sergei Trofimovich gentoo org> AuthorDate: Tue Dec 1 19:16:33 2020 + Commit: Sergei Trofimovich gentoo org> CommitDate: Tue Dec 1 19:16:33 2020 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=9b342fde 10.2.0: backport strncmp() folding Reported-by: Matt Whitlock Bug: https://bugs.gentoo.org/757792 Bug: https://gcc.gnu.org/PR96758 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/41_all_strlen-PR96758.patch | 95 +++ 10.2.0/gentoo/README.history | 3 + 2 files changed, 98 insertions(+) diff --git a/10.2.0/gentoo/41_all_strlen-PR96758.patch b/10.2.0/gentoo/41_all_strlen-PR96758.patch new file mode 100644 index 000..fccf2de --- /dev/null +++ b/10.2.0/gentoo/41_all_strlen-PR96758.patch @@ -0,0 +1,95 @@ +https://bugs.gentoo.org/757792 + +From 0dbfa88edafbe913a7a9099246041e0190aa3948 Mon Sep 17 00:00:00 2001 +From: Jakub Jelinek +Date: Tue, 25 Aug 2020 13:47:10 +0200 +Subject: [PATCH] strlen: Fix handle_builtin_string_cmp [PR96758] + +The following testcase is miscompiled, because handle_builtin_string_cmp +sees a strncmp call with constant last argument 4, where one of the strings +has an upper bound of 5 bytes (due to it being an array of that size) and +the other has a known string length of 1 and the result is used only in +equality comparison. +It is folded into __builtin_strncmp_eq (str1, str2, 4), which is +incorrect, because that means reading 4 bytes from both strings and +comparing that. When one of the strings has known strlen of 1, we want to +compare just 2 bytes, not 4, as strncmp shouldn't compare any bytes beyond +the null. +So, the last argument to __builtin_strncmp_eq should be the minimum of the +provided strncmp last argument and the known string length + 1 (assuming +the other string has only a known upper bound due to array size). + +Besides that, I've noticed the code has been written with the intent to also +support the case where we know exact string length of both strings (but not +the string content, so we can't compute it at compile time). In that case, +both cstlen1 and cstlen2 are non-negative and both arysiz1 and arysiz2 are +negative. We wouldn't optimize that, cmpsiz would be either the strncmp +last argument, or for strcmp the first string length, but varsiz would be +-1 and thus cmpsiz would be never < varsiz. The patch fixes it by using the +correct length, in that case using the minimum of the two and for strncmp +also the last argument. + +2020-08-25 Jakub Jelinek + + PR tree-optimization/96758 + * tree-ssa-strlen.c (handle_builtin_string_cmp): If both cstlen1 + and cstlen2 are set, set cmpsiz to their minimum, otherwise use the + one that is set. If bound is used and smaller than cmpsiz, set cmpsiz + to bound. If both cstlen1 and cstlen2 are set, perform the optimization. + + * gcc.dg/strcmpopt_12.c: New test. + +(cherry picked from commit f982a6ec9b6d98f5f37114b1d7455c54ce5056b8) +--- + gcc/testsuite/gcc.dg/strcmpopt_12.c | 17 + + gcc/tree-ssa-strlen.c | 10 +- + 2 files changed, 26 insertions(+), 1 deletion(-) + create mode 100644 gcc/testsuite/gcc.dg/strcmpopt_12.c + +diff --git a/gcc/testsuite/gcc.dg/strcmpopt_12.c b/gcc/testsuite/gcc.dg/strcmpopt_12.c +new file mode 100644 +index 000..d8077b62f7f +--- /dev/null b/gcc/testsuite/gcc.dg/strcmpopt_12.c +@@ -0,0 +1,17 @@ ++/* PR tree-optimization/96758 */ ++/* { dg-do run } */ ++/* { dg-options "-O2" } */ ++ ++int v = 1; ++ ++int ++main () ++{ ++ const char *s = v ? "a" : "b"; ++ char x[5]; ++ char y[5] = "a\0a"; ++ __builtin_memcpy (x, y, sizeof (y)); ++ if (__builtin_strncmp (x, s, 4) != 0) ++__builtin_abort (); ++ return 0; ++} +diff --git a/gcc/tree-ssa-strlen.c b/gcc/tree-ssa-strlen.c +index 93d095e1896..b0874da5d1e 100644 +--- a/gcc/tree-ssa-strlen.c b/gcc/tree-ssa-strlen.c +@@ -4485,7 +4485,15 @@ handle_builtin_string_cmp (gimple_stmt_iterator *gsi, const vr_values *rvals) + ++cstlen2; + + /* The exact number of characters to compare. */ +- HOST_WIDE_INT cmpsiz = bound < 0 ? cstlen1 < 0 ? cstlen2 : cstlen1 : bound; ++ HOST_WIDE_INT cmpsiz; ++ if (cstlen1 >= 0 && cstlen2 >= 0) ++cmpsiz = MIN (cstlen1, cstlen2); ++ else if (cstlen1 >= 0) ++cmpsiz = cstlen1; ++ else ++cmpsiz = cstlen2; ++ if (bound >= 0) ++cmpsiz = MIN (cmpsiz, bound); + /* The size of the array in which the unknown string is stored. */ + HOST_WIDE_INT varsiz = arysiz1 < 0 ? arysiz2 : arysiz1; + +-- +2.29.2 + diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index e0207e7..8b8c475 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -1,3 +1,6 @@ +5 TODO + + 41_all_strlen-PR96758.patch + 4 04 Nov 2020 + 40_all_ipa-to_frequency.patch
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: 7ecc76113ad46206cbe6e8bdc1ca39bee97be4dd Author: Sergei Trofimovich gentoo org> AuthorDate: Thu Sep 3 17:11:15 2020 + Commit: Sergei Trofimovich gentoo org> CommitDate: Thu Sep 3 17:11:15 2020 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=7ecc7611 10.2.0: backport PR96377 (c vector init syntax) Bug: https://gcc.gnu.org/PR96377 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/37_all_c-vector-init-PR96377.patch | 522 +++ 10.2.0/gentoo/README.history | 1 + 2 files changed, 523 insertions(+) diff --git a/10.2.0/gentoo/37_all_c-vector-init-PR96377.patch b/10.2.0/gentoo/37_all_c-vector-init-PR96377.patch new file mode 100644 index 000..7ef9cdd --- /dev/null +++ b/10.2.0/gentoo/37_all_c-vector-init-PR96377.patch @@ -0,0 +1,522 @@ +https://gcc.gnu.org/PR96377 + +From a216daaa30bc8949086a16e7656f2025b692d03c Mon Sep 17 00:00:00 2001 +From: Richard Sandiford +Date: Mon, 3 Aug 2020 09:48:36 +0100 +Subject: [PATCH] c: Fix bogus vector initialisation error [PR96377] + +One of the problems in this PR was that if we had: + + vector_type1 array[] = { vector_value1 }; + +process_init_element would only treat vector_value1 as initialising +a vector_type1 if they had the same TYPE_MAIN_VARIANT. This has +several problems: + +(1) It gives confusing error messages if the vector types are +incompatible. (Tested by gcc.dg/pr96377-1.c.) + +(2) It means that we reject code that should be valid with +-flax-vector-conversions. (Tested by gcc.dg/pr96377-2.c.) + +(3) On arm and aarch64 targets, it means that we reject some +initializers that mix Advanced SIMD and standard GNU vectors. +These vectors have traditionally had different TYPE_MAIN_VARIANTs +because they have different mangling schemes. (Tested by +gcc.dg/pr96377-[3-6].c.) + +(4) It means that we reject SVE initializers that should be valid. +(Tested by gcc.target/aarch64/sve/gnu_vectors_[34].c.) + +(5) After r11-1741-g:31427b974ed7b7dd54e2 we reject: + + arm_neon_type1 array[] = { k ^ arm_neon_value1 }; + +because applying the binary operator to arm_neon_value1 strips +the "Advanced SIMD type" attributes that were added in that patch. +Stripping the attributes is problematic for other reasons though, +so that still needs to be fixed separately. + +g++.target/aarch64/sve/gnu_vectors_[34].C already pass. + +gcc/c/ + PR c/96377 + * c-typeck.c (process_init_element): Split test for whether to + recurse into a record, union or array into... + (initialize_elementwise_p): ...this new function. Don't recurse + into a vector type if the initialization value is also a vector. + +gcc/testsuite/ + PR c/96377 + * gcc.dg/pr96377-1.c: New test. + * gcc.dg/pr96377-2.c: Likewise. + * gcc.dg/pr96377-3.c: Likewise. + * gcc.dg/pr96377-4.c: Likewise. + * gcc.dg/pr96377-5.c: Likewise. + * gcc.dg/pr96377-6.c: Likewise. + * gcc.target/aarch64/pr96377-1.c: Likewise. + * gcc.target/aarch64/sve/acle/general-c/gnu_vectors_3.c: Likewise. + * gcc.target/aarch64/sve/acle/general-c/gnu_vectors_4.c: Likewise. + * g++.target/aarch64/sve/acle/general-c++/gnu_vectors_3.C: Likewise. + * g++.target/aarch64/sve/acle/general-c++/gnu_vectors_4.C: Likewise. + +(cherry picked from commit 7d599ad27b9bcf5165f87710f1abc64bbabd06ae) +--- + gcc/c/c-typeck.c | 59 ++- + .../sve/acle/general-c++/gnu_vectors_3.C | 15 + + .../sve/acle/general-c++/gnu_vectors_4.C | 15 + + gcc/testsuite/gcc.dg/pr96377-1.c | 32 ++ + gcc/testsuite/gcc.dg/pr96377-2.c | 31 ++ + gcc/testsuite/gcc.dg/pr96377-3.c | 33 +++ + gcc/testsuite/gcc.dg/pr96377-4.c | 32 ++ + gcc/testsuite/gcc.dg/pr96377-5.c | 33 +++ + gcc/testsuite/gcc.dg/pr96377-6.c | 32 ++ + gcc/testsuite/gcc.target/aarch64/pr96377-1.c | 20 +++ + .../sve/acle/general-c/gnu_vectors_3.c| 15 + + .../sve/acle/general-c/gnu_vectors_4.c| 15 + + 12 files changed, 317 insertions(+), 15 deletions(-) + create mode 100644 gcc/testsuite/g++.target/aarch64/sve/acle/general-c++/gnu_vectors_3.C + create mode 100644 gcc/testsuite/g++.target/aarch64/sve/acle/general-c++/gnu_vectors_4.C + create mode 100644 gcc/testsuite/gcc.dg/pr96377-1.c + create mode 100644 gcc/testsuite/gcc.dg/pr96377-2.c + create mode 100644 gcc/testsuite/gcc.dg/pr96377-3.c + create mode 100644 gcc/testsuite/gcc.dg/pr96377-4.c + create mode 100644 gcc/testsuite/gcc.dg/pr96377-5.c + create mode 100644 gcc/testsuite/gcc.dg/pr96377-6.c + create mode 100644 gcc/testsuite/gcc.target/aarch64/pr96377-1.c + create mode 100644 gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/gnu_vectors_3.c + create mode 100644 gcc/testsuite/gcc.target/aarch64/sve
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: c446f6f37e5a5f0867527acdb0b78333e3b70822 Author: Sergei Trofimovich gentoo org> AuthorDate: Thu Aug 13 08:39:49 2020 + Commit: Sergei Trofimovich gentoo org> CommitDate: Thu Aug 13 08:39:49 2020 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=c446f6f3 10.2.0:backport ipa-cp bit fix (PR/96482) Reported-by: Johannes Hirte Bug: https://bugs.gentoo.org/736685 Bug: https://gcc.gnu.org/PR96482 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/35_all_ipa-fix-bit-CP.patch | 145 ++ 10.2.0/gentoo/README.history | 1 + 2 files changed, 146 insertions(+) diff --git a/10.2.0/gentoo/35_all_ipa-fix-bit-CP.patch b/10.2.0/gentoo/35_all_ipa-fix-bit-CP.patch new file mode 100644 index 000..34a1fe0 --- /dev/null +++ b/10.2.0/gentoo/35_all_ipa-fix-bit-CP.patch @@ -0,0 +1,145 @@ +https://bugs.gentoo.org/736685 +https://gcc.gnu.org/PR96482 + +From 66780083a0e79e5cb7c3acc8665aa47be4084a67 Mon Sep 17 00:00:00 2001 +From: Martin Liska +Date: Wed, 12 Aug 2020 09:21:51 +0200 +Subject: [PATCH] ipa: fix bit CPP when combined with IPA bit CP + +As mentioned in the PR, let's consider the following example: + +int +__attribute__((noinline)) +foo(int arg) +{ + if (arg == 3) +return 1; + if (arg == 4) +return 123; + + __builtin_unreachable (); +} + +during WPA we find all calls of the function +(yes the call with value 5 is UBSAN): + + Node: foo/0: +param [0]: 5 [loc_time: 4, loc_size: 2, prop_time: 0, prop_size: 0] + 3 [loc_time: 3, loc_size: 3, prop_time: 0, prop_size: 0] + ctxs: VARIABLE + Bits: value = 0x5, mask = 0x6 + +in LTRANS we have the following VRP info: + + # RANGE [3, 3] NONZERO 3 + +when we AND masks in get_default_value we end up with 6 & 3 = 2 (0x010). +That means the only second (least significant bit) is unknown and +value (5 = 0x101) & ~mask gives us either 7 (0x111) or 5 (0x101). + +That's why if (arg_2(D) == 3) gets optimized to false. + +gcc/ChangeLog: + + PR ipa/96482 + * ipa-cp.c (ipcp_bits_lattice::meet_with_1): Drop value bits + for bits that are unknown. + (ipcp_bits_lattice::set_to_constant): Likewise. + * tree-ssa-ccp.c (get_default_value): Add sanity check that + IPA CP bit info has all bits set to zero in bits that + are unknown. + +gcc/testsuite/ChangeLog: + + PR ipa/96482 + * gcc.dg/ipa/pr96482.c: New test. + +(cherry picked from commit d58f078ce2d53e5dab6b3d0d5f960504268e1894) +--- + gcc/ipa-cp.c | 3 +- + gcc/testsuite/gcc.dg/ipa/pr96482.c | 44 ++ + gcc/tree-ssa-ccp.c | 3 ++ + 3 files changed, 49 insertions(+), 1 deletion(-) + create mode 100644 gcc/testsuite/gcc.dg/ipa/pr96482.c + +--- a/gcc/ipa-cp.c b/gcc/ipa-cp.c +@@ -1010,7 +1010,7 @@ ipcp_bits_lattice::set_to_constant (widest_int value, widest_int mask) + { + gcc_assert (top_p ()); + m_lattice_val = IPA_BITS_CONSTANT; +- m_value = value; ++ m_value = wi::bit_and (wi::bit_not (mask), value); + m_mask = mask; + return true; + } +@@ -1047,6 +1047,7 @@ ipcp_bits_lattice::meet_with_1 (widest_int value, widest_int mask, + + widest_int old_mask = m_mask; + m_mask = (m_mask | mask) | (m_value ^ value); ++ m_value &= value; + + if (wi::sext (m_mask, precision) == -1) + return set_to_bottom (); +--- /dev/null b/gcc/testsuite/gcc.dg/ipa/pr96482.c +@@ -0,0 +1,44 @@ ++/* PR ipa/96482 */ ++/* { dg-do run } */ ++/* { dg-options "-O2 -flto" } */ ++/* { dg-require-effective-target lto } */ ++ ++int ++__attribute__((noinline)) ++foo(int arg) ++{ ++ if (arg == 3) ++return 1; ++ if (arg == 4) ++return 123; ++ ++ __builtin_unreachable (); ++} ++ ++int ++__attribute__((noinline)) ++baz(int x) ++{ ++ if (x != 0) ++return foo(3); /* called */ ++ ++ return 1; ++} ++ ++int ++__attribute__((noinline)) ++bar(int x) ++{ ++ if (x == 0) ++return foo(5); /* not executed */ ++ ++ return 1; ++} ++ ++int main(int argc, char **argv) ++{ ++ if (bar(argc) != baz(argc)) ++__builtin_abort (); ++ ++ return 0; ++} +--- a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c +@@ -306,6 +306,9 @@ get_default_value (tree var) + { + val.lattice_val = CONSTANT; + val.value = value; ++widest_int ipa_value = wi::to_widest (value); ++/* Unknown bits from IPA CP must be equal to zero. */ ++gcc_assert (wi::bit_and (ipa_value, mask) == 0); + val.mask = mask; + if (nonzero_bits != -1) + val.mask &= extend_mask (nonzero_bits, +-- +2.28.0 + diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index 7cde6a3..49edda3 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -1,6 +1,7 @@ 2 TODO + 33_all_lto-O0-mix-ICE-ipa-PR96291.patch + 34_all_fundecl-I
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: 8634da04f3f6214cc36ebfeba38c4f3fca4473be Author: Sergei Trofimovich gentoo org> AuthorDate: Thu Mar 4 10:59:30 2021 + Commit: Sergei Trofimovich gentoo org> CommitDate: Thu Mar 4 10:59:30 2021 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=8634da04 10.2.0: backport PR97236: fix bad use of VMAT_CONTIGUOUS Bug: https://gcc.gnu.org/PR97236 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/42_all_vmat-PR97236.patch | 116 10.2.0/gentoo/README.history| 3 + 2 files changed, 119 insertions(+) diff --git a/10.2.0/gentoo/42_all_vmat-PR97236.patch b/10.2.0/gentoo/42_all_vmat-PR97236.patch new file mode 100644 index 000..5a7643c --- /dev/null +++ b/10.2.0/gentoo/42_all_vmat-PR97236.patch @@ -0,0 +1,116 @@ +https://gcc.gnu.org/PR97236 + +From 1ab88985631dd2c5a5e3b5c0dce47cf8b6ed2f82 Mon Sep 17 00:00:00 2001 +From: Matthias Klose +Date: Tue, 6 Oct 2020 13:41:37 +0200 +Subject: [PATCH] Backport fix for PR/tree-optimization/97236 - fix bad use of + VMAT_CONTIGUOUS + +This avoids using VMAT_CONTIGUOUS with single-element interleaving +when using V1mode vectors. Instead keep VMAT_ELEMENTWISE but +continue to avoid load-lanes and gathers. + +2020-10-01 Richard Biener + + PR tree-optimization/97236 + * tree-vect-stmts.c (get_group_load_store_type): Keep + VMAT_ELEMENTWISE for single-element vectors. + + * gcc.dg/vect/pr97236.c: New testcase. +--- + gcc/testsuite/gcc.dg/vect/pr97236.c | 43 + + gcc/tree-vect-stmts.c | 20 ++ + 2 files changed, 52 insertions(+), 11 deletions(-) + create mode 100644 gcc/testsuite/gcc.dg/vect/pr97236.c + +diff --git a/gcc/testsuite/gcc.dg/vect/pr97236.c b/gcc/testsuite/gcc.dg/vect/pr97236.c +new file mode 100644 +index 000..9d3dc20d953 +--- /dev/null b/gcc/testsuite/gcc.dg/vect/pr97236.c +@@ -0,0 +1,43 @@ ++typedef unsigned char __uint8_t; ++typedef __uint8_t uint8_t; ++typedef struct plane_t { ++ uint8_t *p_pixels; ++ int i_lines; ++ int i_pitch; ++} plane_t; ++ ++typedef struct { ++ plane_t p[5]; ++} picture_t; ++ ++#define N 4 ++ ++void __attribute__((noipa)) ++picture_Clone(picture_t *picture, picture_t *res) ++{ ++ for (int i = 0; i < N; i++) { ++res->p[i].p_pixels = picture->p[i].p_pixels; ++res->p[i].i_lines = picture->p[i].i_lines; ++res->p[i].i_pitch = picture->p[i].i_pitch; ++ } ++} ++ ++int ++main() ++{ ++ picture_t aaa, bbb; ++ uint8_t pixels[10] = {1, 1, 1, 1, 1, 1, 1, 1}; ++ ++ for (unsigned i = 0; i < N; i++) ++aaa.p[i].p_pixels = pixels; ++ ++ picture_Clone (&aaa, &bbb); ++ ++ uint8_t c = 0; ++ for (unsigned i = 0; i < N; i++) ++c += bbb.p[i].p_pixels[0]; ++ ++ if (c != N) ++__builtin_abort (); ++ return 0; ++} +diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c +index 9ace345fc5e..d8b2ff3d6ee 100644 +--- a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c +@@ -2413,25 +2413,23 @@ get_group_load_store_type (stmt_vec_info stmt_info, tree vectype, bool slp, + /* First cope with the degenerate case of a single-element +vector. */ + if (known_eq (TYPE_VECTOR_SUBPARTS (vectype), 1U)) +- *memory_access_type = VMAT_CONTIGUOUS; ++ ; + + /* Otherwise try using LOAD/STORE_LANES. */ +-if (*memory_access_type == VMAT_ELEMENTWISE +-&& (vls_type == VLS_LOAD +-? vect_load_lanes_supported (vectype, group_size, masked_p) +-: vect_store_lanes_supported (vectype, group_size, +- masked_p))) ++else if (vls_type == VLS_LOAD ++ ? vect_load_lanes_supported (vectype, group_size, masked_p) ++ : vect_store_lanes_supported (vectype, group_size, ++ masked_p)) + { + *memory_access_type = VMAT_LOAD_STORE_LANES; + overrun_p = would_overrun_p; + } + + /* If that fails, try using permuting loads. */ +-if (*memory_access_type == VMAT_ELEMENTWISE +-&& (vls_type == VLS_LOAD +-? vect_grouped_load_supported (vectype, single_element_p, +- group_size) +-: vect_grouped_store_supported (vectype, group_size))) ++else if (vls_type == VLS_LOAD ++ ? vect_grouped_load_supported (vectype, single_element_p, ++group_size) ++ : vect_grouped_store_supported (vectype, group_size)) + { + *memory_access_type = VMAT_CONTIGUOUS_PERMUTE; + overrun_p = would_overrun_p; +-- +2.30.1 + diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index 48587e1..4ca261a 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -1,3 +1,6 @
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: ff3a446afb9e0abb87869e85826454e85ef398c3 Author: Sergei Trofimovich gentoo org> AuthorDate: Mon Mar 15 22:55:21 2021 + Commit: Sergei Trofimovich gentoo org> CommitDate: Mon Mar 15 22:57:07 2021 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=ff3a446a 10.2.0: fix vtv build on slibtool Reported-by: orbea riseup.net Bug: https://gcc.gnu.org/PR99172 Bug: https://bugs.gentoo.org/767706 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/43_all_vtv-slibtool.patch | 62 + 10.2.0/gentoo/README.history| 1 + 2 files changed, 63 insertions(+) diff --git a/10.2.0/gentoo/43_all_vtv-slibtool.patch b/10.2.0/gentoo/43_all_vtv-slibtool.patch new file mode 100644 index 000..b5716f9 --- /dev/null +++ b/10.2.0/gentoo/43_all_vtv-slibtool.patch @@ -0,0 +1,62 @@ +https://bugs.gentoo.org/767706 +https://gcc.gnu.org/PR99172 + +From c2be82058fb40f3ae891c68d185ff53e07f14f45 Mon Sep 17 00:00:00 2001 +From: Caroline Tice +Date: Fri, 12 Mar 2021 07:34:36 -0800 +Subject: [PATCH] libstdc++-v3: Update VTV vars for libtool link commands + [PR99172] + +This fixes PR 99172 + +Currently when GCC is configured with --enable-vtable-verify, the +libstdc++-v3 Makefiles add "-fvtable-verify=std +-Wl,-u_vtable_map_vars_start,-u_vtable_map_vars_end" to libtool link +commands. The "-fvtable-verify=std" piece causes alternate versions of +libtool (such as slibtool) to fail, unable to find "-lvtv" (GNU +libtool just removes that piece). + +This patch updates the libstdc++-v3 Makefiles to not pass +"-fvtable-verify=std" to the libtool link commands. +--- + libstdc++-v3/src/Makefile.am | 4 +++- + libstdc++-v3/src/Makefile.in | 3 ++- + +--- a/libstdc++-v3/src/Makefile.am b/libstdc++-v3/src/Makefile.am +@@ -214,12 +214,14 @@ compatibility-condvar.o: compatibility-condvar.cc + # set this option because CONFIG_CXXFLAGS has to be after + # OPTIMIZE_CXXFLAGS on the compile line so that -O2 can be overridden + # as the occasion calls for it. +-AM_CXXFLAGS = \ ++AM_CXXFLAGS_PRE = \ + -std=gnu++98 \ + $(glibcxx_compiler_pic_flag) \ + $(XTEMPLATE_FLAGS) $(VTV_CXXFLAGS) \ + $(WARN_CXXFLAGS) $(OPTIMIZE_CXXFLAGS) $(CONFIG_CXXFLAGS) + ++AM_CXXFLAGS = $(filter-out -fvtable-verify=std,$(AM_CXXFLAGS_PRE)) ++ + # Libtool notes + + # 1) In general, libtool expects an argument such as `--tag=CXX' when +--- a/libstdc++-v3/src/Makefile.in b/libstdc++-v3/src/Makefile.in +@@ -578,12 +578,13 @@ libstdc___la_LINK = $(CXXLINK) $(libstdc___la_LDFLAGS) $(lt_host_flags) + # set this option because CONFIG_CXXFLAGS has to be after + # OPTIMIZE_CXXFLAGS on the compile line so that -O2 can be overridden + # as the occasion calls for it. +-AM_CXXFLAGS = \ ++AM_CXXFLAGS_PRE = \ + -std=gnu++98 \ + $(glibcxx_compiler_pic_flag) \ + $(XTEMPLATE_FLAGS) $(VTV_CXXFLAGS) \ + $(WARN_CXXFLAGS) $(OPTIMIZE_CXXFLAGS) $(CONFIG_CXXFLAGS) + ++AM_CXXFLAGS = $(filter-out -fvtable-verify=std,$(AM_CXXFLAGS_PRE)) + + # Libtool notes + +-- +2.30.2 + diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index 4ca261a..f195ae9 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -1,5 +1,6 @@ 7 TODO + 42_all_vmat-PR97236.patch + + 43_all_vtv-slibtool.patch 6 29 Dec 2020 - 34_all_fundecl-ICE-PR95820.patch
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: 7adab39a82fd07085f600603bdc5c440aa1c142a Author: Sergei Trofimovich gentoo org> AuthorDate: Tue Dec 29 09:51:52 2020 + Commit: Sergei Trofimovich gentoo org> CommitDate: Tue Dec 29 09:51:52 2020 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=7adab39a 10.2.0: revert PR95820 backporting The backport breaks parsing as seen in https://gcc.gnu.org/PR98441 Bug: https://gcc.gnu.org/PR95820 Bug: https://bugs.gentoo.org/730406 Reported-by: Daniel Santos Bug: https://gcc.gnu.org/PR98441 Bug: https://bugs.gentoo.org/762382 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/34_all_fundecl-ICE-PR95820.patch | 25 - 10.2.0/gentoo/README.history | 3 +++ 2 files changed, 3 insertions(+), 25 deletions(-) diff --git a/10.2.0/gentoo/34_all_fundecl-ICE-PR95820.patch b/10.2.0/gentoo/34_all_fundecl-ICE-PR95820.patch deleted file mode 100644 index e365420..000 --- a/10.2.0/gentoo/34_all_fundecl-ICE-PR95820.patch +++ /dev/null @@ -1,25 +0,0 @@ -It's an unofficial backport of PR95820 where gcc ICEs on -invalid syntax. As creduce frequently end up in these ICEs -as in #730406 let's backport it to gcc-10. - -https://gcc.gnu.org/PR95820 -https://bugs.gentoo.org/730406 a/gcc/cp/decl.c -+++ b/gcc/cp/decl.c -@@ -12029,14 +12029,11 @@ grokdeclarator (const cp_declarator *declarator, - - /* Handle a late-specified return type. */ - tree late_return_type = declarator->u.function.late_return_type; -- if (funcdecl_p -- /* This is the case e.g. for -- using T = auto () -> int. */ -- || inner_declarator == NULL) -+ if (true) - { - if (tree auto_node = type_uses_auto (type)) - { -- if (!late_return_type) -+ if (!late_return_type && funcdecl_p) - { - if (current_class_type - && LAMBDA_TYPE_P (current_class_type)) diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index 639805d..81678b5 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -1,3 +1,6 @@ +6 TODO + - 34_all_fundecl-ICE-PR95820.patch + 5 18 Dec 2020 + 41_all_strlen-PR96758.patch
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: e71e59c25315ebda3ebf4014bb108db9dda08a27 Author: Sergei Trofimovich gentoo org> AuthorDate: Fri Dec 18 20:57:44 2020 + Commit: Sergei Trofimovich gentoo org> CommitDate: Fri Dec 18 20:57:44 2020 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=e71e59c2 10.2.0: cut 5 patchset Single new patch: + 41_all_strlen-PR96758.patch: fix string comparison against literals Bug: https://bugs.gentoo.org/757792 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/README.history | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index 8b8c475..639805d 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -1,4 +1,4 @@ -5 TODO +5 18 Dec 2020 + 41_all_strlen-PR96758.patch 4 04 Nov 2020
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: 3779ee05e8c035d435c62198f3b761516e63fdf0 Author: Sergei Trofimovich gentoo org> AuthorDate: Tue Dec 29 10:05:50 2020 + Commit: Sergei Trofimovich gentoo org> CommitDate: Tue Dec 29 10:05:50 2020 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=3779ee05 10.2.0: cut 6 patchset Single dropped patch: - 34_all_fundecl-ICE-PR95820.patch: revert PR95820 backporting Bug: https://gcc.gnu.org/PR95820 Bug: https://bugs.gentoo.org/730406 Reported-by: Daniel Santos Bug: https://gcc.gnu.org/PR98441 Bug: https://bugs.gentoo.org/762382 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/README.history | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index 81678b5..48587e1 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -1,4 +1,4 @@ -6 TODO +6 29 Dec 2020 - 34_all_fundecl-ICE-PR95820.patch 5 18 Dec 2020
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: 0d98cab225ecb321bc18d894951bb2d3b7b45bd0 Author: Sergei Trofimovich gentoo org> AuthorDate: Mon Aug 17 21:26:01 2020 + Commit: Sergei Trofimovich gentoo org> CommitDate: Mon Aug 17 21:26:01 2020 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=0d98cab2 10.2.0: backport ipa-cp bit fix, part 2 (PR/96482) Reported-by: Johannes Hirte Bug: https://bugs.gentoo.org/736685 Bug: https://gcc.gnu.org/PR96482 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/36_all_ipa-fix-bit-CP-p2.patch | 80 10.2.0/gentoo/README.history | 1 + 2 files changed, 81 insertions(+) diff --git a/10.2.0/gentoo/36_all_ipa-fix-bit-CP-p2.patch b/10.2.0/gentoo/36_all_ipa-fix-bit-CP-p2.patch new file mode 100644 index 000..1183b57 --- /dev/null +++ b/10.2.0/gentoo/36_all_ipa-fix-bit-CP-p2.patch @@ -0,0 +1,80 @@ +https://bugs.gentoo.org/736685 +https://gcc.gnu.org/PR96482 + +From 4a2371497e9bed64aa4f46169127f3ea8e32e726 Mon Sep 17 00:00:00 2001 +From: Martin Liska +Date: Thu, 13 Aug 2020 09:38:41 +0200 +Subject: [PATCH] ipa: fix ICE in get_default_value + +The patch aligns code with ipcp_bits_lattice::set_to_constant +where we properly mask m_value with m_mask. The same should +be done here. + +gcc/ChangeLog: + + PR ipa/96482 + * ipa-cp.c (ipcp_bits_lattice::meet_with_1): Mask m_value + with m_mask. + +gcc/testsuite/ChangeLog: + + PR ipa/96482 + * gcc.dg/ipa/pr96482-2.c: New test. + +(cherry picked from commit f91770216eade83f068528c1e4f00e2ac3b23044) +--- + gcc/ipa-cp.c | 2 +- + gcc/testsuite/gcc.dg/ipa/pr96482-2.c | 33 + 2 files changed, 34 insertions(+), 1 deletion(-) + create mode 100644 gcc/testsuite/gcc.dg/ipa/pr96482-2.c + +--- a/gcc/ipa-cp.c b/gcc/ipa-cp.c +@@ -1047,7 +1047,7 @@ ipcp_bits_lattice::meet_with_1 (widest_int value, widest_int mask, + + widest_int old_mask = m_mask; + m_mask = (m_mask | mask) | (m_value ^ value); +- m_value &= value; ++ m_value &= ~m_mask; + + if (wi::sext (m_mask, precision) == -1) + return set_to_bottom (); +--- /dev/null b/gcc/testsuite/gcc.dg/ipa/pr96482-2.c +@@ -0,0 +1,33 @@ ++/* PR ipa/96482 */ ++/* { dg-do compile } */ ++/* { dg-options "-O2" } */ ++ ++int i2c_transfer(); ++void _dev_err(); ++ ++struct i2c_msg { ++ char bufaddr; ++ int adapterdev; ++} wdt87xx_i2c_xfer_client; ++ ++int wdt87xx_i2c_xfer_client_0, wdt87xx_i2c_xfer_rxdata, wdt87xx_get_string_str_idx; ++ ++void ++static wdt87xx_i2c_xfer(void *txdata, unsigned rxlen) { ++ struct i2c_msg msgs[] = {wdt87xx_i2c_xfer_client_0, rxlen, ++ wdt87xx_i2c_xfer_rxdata}; ++ int error = i2c_transfer(wdt87xx_i2c_xfer_client, msgs); ++ _dev_err("", __func__, error); ++} ++static void wdt87xx_get_string(unsigned len) { ++ char tx_buf[] = {wdt87xx_get_string_str_idx, 3}; ++ int rx_len = len + 2; ++ wdt87xx_i2c_xfer(tx_buf, rx_len); ++} ++ ++void ++wdt87xx_ts_probe_tx_buf() { ++ wdt87xx_get_string(34); ++ wdt87xx_get_string(8); ++ wdt87xx_i2c_xfer(wdt87xx_ts_probe_tx_buf, 2); ++} +-- +2.28.0 + diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index 49edda3..8be215b 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -2,6 +2,7 @@ + 33_all_lto-O0-mix-ICE-ipa-PR96291.patch + 34_all_fundecl-ICE-PR95820.patch + 35_all_ipa-fix-bit-CP.patch + + 36_all_ipa-fix-bit-CP-p2.patch 1 23 July 2020 + 01_all_default-fortify-source.patch
[gentoo-commits] proj/gcc-patches:master commit in: 10.2.0/gentoo/
commit: 9bba1f72a9210743fddf664b716b5cf288132922 Author: Sergei Trofimovich gentoo org> AuthorDate: Sun Aug 23 09:11:31 2020 + Commit: Sergei Trofimovich gentoo org> CommitDate: Sun Aug 23 09:11:31 2020 + URL:https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=9bba1f72 10.2.0: cut 2 patchset Four new patches: + 33_all_lto-O0-mix-ICE-ipa-PR96291.patch: fix -O0 crash for ipa/lto + 34_all_fundecl-ICE-PR95820.patch: fix ICE on invalid templates + 35_all_ipa-fix-bit-CP.patch: fix bad code generation in ipa bit constprop + 36_all_ipa-fix-bit-CP-p2.patch: part 2 of previous patch Bug: https://bugs.gentoo.org/733482 Bug: https://gcc.gnu.org/PR96291 Bug: https://bugs.gentoo.org/730406 Bug: https://gcc.gnu.org/PR95820 Bug: https://bugs.gentoo.org/736685 Bug: https://gcc.gnu.org/PR96482 Signed-off-by: Sergei Trofimovich gentoo.org> 10.2.0/gentoo/README.history | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index 8be215b..1bfe565 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -1,4 +1,4 @@ -2 TODO +2 23 Aug 2020 + 33_all_lto-O0-mix-ICE-ipa-PR96291.patch + 34_all_fundecl-ICE-PR95820.patch + 35_all_ipa-fix-bit-CP.patch