summaryrefslogtreecommitdiff
path: root/gcc/gimplify.c
diff options
context:
space:
mode:
authorebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2007-02-19 19:11:37 +0000
committerebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2007-02-19 19:11:37 +0000
commitf62a072cf6c06a2ab3caf7a91d3d4780e6aea2a7 (patch)
treeaa25bc1935ed24eb30636d7e63fddb62f545bd69 /gcc/gimplify.c
parentae8552b7366c9d3815e02a0b9cacdb89de80b30c (diff)
downloadgcc-f62a072cf6c06a2ab3caf7a91d3d4780e6aea2a7.tar.gz
* 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
Diffstat (limited to 'gcc/gimplify.c')
-rw-r--r--gcc/gimplify.c15
1 files changed, 15 insertions, 0 deletions
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;