From f62a072cf6c06a2ab3caf7a91d3d4780e6aea2a7 Mon Sep 17 00:00:00 2001 From: ebotcazou Date: Mon, 19 Feb 2007 19:11:37 +0000 Subject: * gimplify.c (gimplify_init_ctor_preeval_1): Detect potential overlap due to calls to functions taking pointers as parameters. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@122133 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/gimplify.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'gcc/gimplify.c') diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 34e6249d2a2..02eed6aa9ad 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -2628,6 +2628,21 @@ gimplify_init_ctor_preeval_1 (tree *tp, int *walk_subtrees, void *xdata) && alias_sets_conflict_p (data->lhs_alias_set, get_alias_set (t))) return t; + /* If the constructor component is a call, determine if it can hide a + potential overlap with the lhs through an INDIRECT_REF like above. */ + if (TREE_CODE (t) == CALL_EXPR) + { + tree type, fntype = TREE_TYPE (TREE_TYPE (CALL_EXPR_FN (t))); + + for (type = TYPE_ARG_TYPES (fntype); type; type = TREE_CHAIN (type)) + if (POINTER_TYPE_P (TREE_VALUE (type)) + && (!data->lhs_base_decl || TREE_ADDRESSABLE (data->lhs_base_decl)) + && alias_sets_conflict_p (data->lhs_alias_set, + get_alias_set + (TREE_TYPE (TREE_VALUE (type))))) + return t; + } + if (IS_TYPE_OR_DECL_P (t)) *walk_subtrees = 0; return NULL; -- cgit v1.2.1