aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/cp-gimplify.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2018-03-16 08:38:42 -0400
committerJason Merrill <jason@gcc.gnu.org>2018-03-16 08:38:42 -0400
commitaafdbe06af7127972c483fb2c9bf07b542b49d23 (patch)
tree1cbe31ec81992446813373623fb8fe08fe1e5de3 /gcc/cp/cp-gimplify.c
parenta1295eec4e21ad46774b829e2b54b04d8f0e5e35 (diff)
downloadgcc-aafdbe06af7127972c483fb2c9bf07b542b49d23.zip
gcc-aafdbe06af7127972c483fb2c9bf07b542b49d23.tar.gz
gcc-aafdbe06af7127972c483fb2c9bf07b542b49d23.tar.bz2
PR c++/83911 - ICE with multiversioned constructor.
* cp-gimplify.c (cp_genericize_r): Replace versioned function with dispatchere here. * call.c (build_over_call): Not here. PR c++/83911 - ICE with multiversioned constructor. From-SVN: r258592
Diffstat (limited to 'gcc/cp/cp-gimplify.c')
-rw-r--r--gcc/cp/cp-gimplify.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/gcc/cp/cp-gimplify.c b/gcc/cp/cp-gimplify.c
index 0ddd435..653d1dce 100644
--- a/gcc/cp/cp-gimplify.c
+++ b/gcc/cp/cp-gimplify.c
@@ -1513,6 +1513,29 @@ cp_genericize_r (tree *stmt_p, int *walk_subtrees, void *data)
== REFERENCE_TYPE))
*walk_subtrees = 0;
}
+ /* Fall through. */
+ case AGGR_INIT_EXPR:
+ /* For calls to a multi-versioned function, overload resolution
+ returns the function with the highest target priority, that is,
+ the version that will checked for dispatching first. If this
+ version is inlinable, a direct call to this version can be made
+ otherwise the call should go through the dispatcher. */
+ {
+ tree fn = cp_get_callee_fndecl (stmt);
+ if (fn && DECL_FUNCTION_VERSIONED (fn)
+ && (current_function_decl == NULL
+ || !targetm.target_option.can_inline_p (current_function_decl,
+ fn)))
+ if (tree dis = get_function_version_dispatcher (fn))
+ {
+ mark_versions_used (dis);
+ dis = build_address (dis);
+ if (TREE_CODE (stmt) == CALL_EXPR)
+ CALL_EXPR_FN (stmt) = dis;
+ else
+ AGGR_INIT_EXPR_FN (stmt) = dis;
+ }
+ }
break;
default: