diff --git a/gcc.spec b/gcc.spec index d00d241..70bcb70 100644 --- a/gcc.spec +++ b/gcc.spec @@ -305,6 +305,7 @@ Patch9: gcc14-Wno-format-security.patch Patch10: gcc14-rh1574936.patch Patch11: gcc14-d-shared-libphobos.patch Patch12: gcc14-pr101523.patch +Patch13: gcc14-pr118509.patch Patch50: isl-rh2155127.patch @@ -906,6 +907,7 @@ so that there cannot be any synchronization problems. %endif %patch -P11 -p0 -b .d-shared-libphobos~ %patch -P12 -p1 -b .pr101523~ +%patch -P13 -p0 -b .pr118509~ %patch -P50 -p0 -b .rh2155127~ touch -r isl-0.24/m4/ax_prog_cxx_for_build.m4 isl-0.24/m4/ax_prog_cc_for_build.m4 @@ -3662,13 +3664,7 @@ end - fix up -freport-bug default (#2330362, RHEL-73475) - revert -mearly-ldp-fusion and -mlate-ldp-fusion default to enabled on aarch64 to match upstream (RHEL-73585) - -* Mon Nov 4 2024 Jakub Jelinek 14.2.1-6 -- update from releases/gcc-14 branch - - PRs fortran/79685, jit/117275, libstdc++/117321, libstdc++/117406, - middle-end/117354, rtl-optimization/116783, rtl-optimization/117327, - target/116415, target/117296, target/117318, tree-optimization/107467, - tree-optimization/117287 +- consider TARGET_EXPR invariant like SAVE_EXPR (PR c++/118509) * Wed Nov 6 2024 Joseph Myers - 14.2.1-6 - update from releases/gcc-14 branch diff --git a/gcc14-pr118509.patch b/gcc14-pr118509.patch new file mode 100644 index 0000000..6e19016 --- /dev/null +++ b/gcc14-pr118509.patch @@ -0,0 +1,56 @@ +2025-01-20 Jakub Jelinek + + PR c++/118509 + * typeck.cc (get_member_function_from_ptrfunc): Wrap force_target_expr + with save_expr. + + * g++.dg/expr/pmf-4.C: New test. + +--- gcc/cp/typeck.cc.jj 2025-01-09 10:10:28.042651891 +0100 ++++ gcc/cp/typeck.cc 2025-01-20 15:09:24.200053590 +0100 +@@ -4187,8 +4187,8 @@ get_member_function_from_ptrfunc (tree * + && !DECL_P (instance_ptr) + && !TREE_CONSTANT (instance_ptr))) + instance_ptr = instance_save_expr +- = force_target_expr (TREE_TYPE (instance_ptr), instance_ptr, +- complain); ++ = save_expr (force_target_expr (TREE_TYPE (instance_ptr), ++ instance_ptr, complain)); + + /* See above comment. */ + if (TREE_SIDE_EFFECTS (function) +@@ -4196,7 +4196,8 @@ get_member_function_from_ptrfunc (tree * + && !DECL_P (function) + && !TREE_CONSTANT (function))) + function +- = force_target_expr (TREE_TYPE (function), function, complain); ++ = save_expr (force_target_expr (TREE_TYPE (function), function, ++ complain)); + + /* Start by extracting all the information from the PMF itself. */ + e3 = pfn_from_ptrmemfunc (function); +--- gcc/testsuite/g++.dg/expr/pmf-4.C.jj ++++ gcc/testsuite/g++.dg/expr/pmf-4.C +@@ -0,0 +1,22 @@ ++// PR c++/118509 ++// { dg-do run } ++// { dg-options "-Wall -O2" } ++ ++struct A { void foo () { a = 1; } int a; A () : a (0) {} }; ++struct B : virtual A {}; ++typedef void (A::*C) (); ++ ++__attribute__((noipa)) void ++foo (C x, B *y) ++{ ++ (y->*x) (); ++} ++ ++int ++main () ++{ ++ B b; ++ foo (&A::foo, &b); ++ if (b.a != 1) ++ __builtin_abort (); ++}