+2019-10-29 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/92201
+ * cp-gimplify.c (cp_gimplify_expr): If gimplify_to_rvalue changes the
+ function pointer type, re-add cast to the original one.
+
2019-10-29 Marek Polacek <polacek@redhat.com>
PR c++/91548 - fix detecting modifying const objects for ARRAY_REF.
&& CALL_EXPR_FN (*expr_p)
&& cp_get_callee_fndecl_nofold (*expr_p) == NULL_TREE)
{
+ tree fnptrtype = TREE_TYPE (CALL_EXPR_FN (*expr_p));
enum gimplify_status t
= gimplify_to_rvalue (&CALL_EXPR_FN (*expr_p), pre_p, NULL,
is_gimple_call_addr);
if (t == GS_ERROR)
ret = GS_ERROR;
+ /* GIMPLE considers most pointer conversion useless, but for
+ calls we actually care about the exact function pointer type. */
+ else if (TREE_TYPE (CALL_EXPR_FN (*expr_p)) != fnptrtype)
+ CALL_EXPR_FN (*expr_p)
+ = build1 (NOP_EXPR, fnptrtype, CALL_EXPR_FN (*expr_p));
}
if (!CALL_EXPR_FN (*expr_p))
/* Internal function call. */;
+2019-10-29 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/92201
+ * g++.dg/other/pr92201.C: New test.
+
2019-10-29 Marek Polacek <polacek@redhat.com>
PR c++/91548 - fix detecting modifying const objects for ARRAY_REF.