commit: 159861cae830939e4b380f74e250e2c48c305420 Author: Sam James <sam <AT> gentoo <DOT> org> AuthorDate: Wed Nov 12 04:37:40 2025 +0000 Commit: Sam James <sam <AT> gentoo <DOT> org> CommitDate: Wed Nov 12 04:37:40 2025 +0000 URL: https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=159861ca
15.2.0: add fix for firefox+lto ICE Bug: https://gcc.gnu.org/PR122620 Signed-off-by: Sam James <sam <AT> gentoo.org> 15.2.0/gentoo/85_all_PR122620-firefox.patch | 90 +++++++++++++++++++++++++++++ 15.2.0/gentoo/README.history | 4 ++ 2 files changed, 94 insertions(+) diff --git a/15.2.0/gentoo/85_all_PR122620-firefox.patch b/15.2.0/gentoo/85_all_PR122620-firefox.patch new file mode 100644 index 0000000..c745fc2 --- /dev/null +++ b/15.2.0/gentoo/85_all_PR122620-firefox.patch @@ -0,0 +1,90 @@ +https://gcc.gnu.org/cgit/gcc/commit/?id=2e22ffe5de54ac245c7c9fa6a0918a5729f71deb + +From 2e22ffe5de54ac245c7c9fa6a0918a5729f71deb Mon Sep 17 00:00:00 2001 +From: Jakub Jelinek <[email protected]> +Date: Tue, 11 Nov 2025 08:29:22 +0100 +Subject: gimplify-me: Fix regimplification of gimple-reg-type clobbers + [PR122620] + +Since r11-2238-ge443d8213864ac337c29092d4767224f280d2062 the C++ FE +emits clobbers like *_1 = {CLOBBER}; where *_1 MEM_REF has some scalar +type like int for -flifetime-dse={1,2} and most of the compiler manages +to cope with that. +If we are very unlucky, we trigger an ICE while trying to regimplify it +(at least during inlining), as happens with GCC 15.2 on firefox-145.0 +built with LTO+PGO. +I haven't managed to reduce that to a small testcase that would ICE though, +the clobber certainly appears in code like +template <typename T> +struct S { + T *p; + union { char a; T b; }; + static S foo (T *x) { S s; s.p = x; s.b.~T (); return s; } + ~S (); +}; + +void +bar () +{ + int i = 42; + S <int> s = S <int>::foo (&i); +} +but convincing inliner that it should id->regimplify = true; on exactly +that stmt has been difficult. + +The ICE is because we try (in two spots) to regimplify the rhs of the +gimple_clobber_p stmt if gimple-reg-type type (i.e. the TREE_CLOBBER), +because it doesn't satisfy the is_gimple_mem_rhs_or_call predicate +returned by rhs_predicate_for for the MEM_REF lhs. And regimplify it +by trying to gimplify SSA_NAME = {CLOBBER}; INIT_EXPR and in there reach +a special case which stores that freshly made SSA_NAME into memory and +loads it from memory, so uses a SSA_NAME without SSA_NAME_DEF_STMT. + +Fixed thusly by saying clobbers are ok even for the gimple-reg-types. + +2025-11-11 Jakub Jelinek <[email protected]> + + PR lto/122620 + * gimplify-me.cc (gimple_regimplify_operands): Don't try to regimplify + TREE_CLOBBER on rhs of gimple_clobber_p if it has gimple_reg_type. + +(cherry picked from commit 8f3242ce5c03c30f806f54ceaff2a15d6e5b5ee6) +--- + gcc/gimplify-me.cc | 15 ++++++++++----- + 1 file changed, 10 insertions(+), 5 deletions(-) + +diff --git a/gcc/gimplify-me.cc b/gcc/gimplify-me.cc +index 740782281efa..d94bbb071404 100644 +--- a/gcc/gimplify-me.cc ++++ b/gcc/gimplify-me.cc +@@ -232,9 +232,13 @@ gimple_regimplify_operands (gimple *stmt, gimple_stmt_iterator *gsi_p) + else if (i == 2 + && gimple_assign_single_p (stmt) + && num_ops == 2) +- gimplify_expr (&op, &pre, NULL, +- rhs_predicate_for (gimple_assign_lhs (stmt)), +- fb_rvalue); ++ { ++ if (gimple_clobber_p (stmt)) ++ continue; ++ gimplify_expr (&op, &pre, NULL, ++ rhs_predicate_for (gimple_assign_lhs (stmt)), ++ fb_rvalue); ++ } + else if (i == 2 && is_gimple_call (stmt)) + { + if (TREE_CODE (op) == FUNCTION_DECL) +@@ -253,8 +257,9 @@ gimple_regimplify_operands (gimple *stmt, gimple_stmt_iterator *gsi_p) + { + bool need_temp = false; + +- if (gimple_assign_single_p (stmt) +- && num_ops == 2) ++ if (gimple_clobber_p (stmt)) ++ ; ++ else if (gimple_assign_single_p (stmt) && num_ops == 2) + gimplify_expr (gimple_assign_rhs1_ptr (stmt), &pre, NULL, + rhs_predicate_for (gimple_assign_lhs (stmt)), + fb_rvalue); +-- +cgit diff --git a/15.2.0/gentoo/README.history b/15.2.0/gentoo/README.history index 63975a5..70106b6 100644 --- a/15.2.0/gentoo/README.history +++ b/15.2.0/gentoo/README.history @@ -1,3 +1,7 @@ +2 11 November 2025 + + + 85_all_PR122620-firefox.patch + 1 2 October 2025 + 01_all_default-fortify-source.patch
