https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116449

--- Comment #5 from Franz Sirl <sirl at gcc dot gnu.org> ---
This small change fixes the bug and passes bootstrap and regtests on x86_64.

--- a/gcc/cp/typeck.cc
+++ b/gcc/cp/typeck.cc
@@ -4195,7 +4195,7 @@ get_member_function_from_ptrfunc (tree *instance_ptrptr,
tree function,
        function = save_expr (function);

       /* Start by extracting all the information from the PMF itself.  */
-      e3 = pfn_from_ptrmemfunc (function);
+      e3 = save_expr(pfn_from_ptrmemfunc (function));
       delta = delta_from_ptrmemfunc (function);
       idx = build1 (NOP_EXPR, vtable_index_type, e3);
       switch (TARGET_PTRMEMFUNC_VBIT_LOCATION)

But note I have no idea what I actually did here, this is the result of
guesswork according to the comments here and on IRC, staring at the .original
dumps and at the code in get_member_function_from_ptrfunc().
>From the looks of it in the .original dumps DELTA may need a SAVE_EXPR too.

Reply via email to