Commit df10ee2a by Eric Botcazou Committed by Eric Botcazou

gimplify.c (gimplify_init_ctor_preeval_1): Detect potential overlap due to calls…

gimplify.c (gimplify_init_ctor_preeval_1): Detect potential overlap due to calls to functions taking pointers as parameters.

	* gimplify.c (gimplify_init_ctor_preeval_1): Detect potential overlap
	due to calls to functions taking pointers as parameters.

From-SVN: r122133
parent 9f8c6739
2007-02-19 Eric Botcazou <ebotcazou@adacore.com>
* gimplify.c (gimplify_init_ctor_preeval_1): Detect potential overlap
due to calls to functions taking pointers as parameters.
2007-02-19 Richard Henderson <rth@redhat.com> 2007-02-19 Richard Henderson <rth@redhat.com>
PR debug/29558 PR debug/29558
......
...@@ -2628,6 +2628,21 @@ gimplify_init_ctor_preeval_1 (tree *tp, int *walk_subtrees, void *xdata) ...@@ -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))) && alias_sets_conflict_p (data->lhs_alias_set, get_alias_set (t)))
return 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)) if (IS_TYPE_OR_DECL_P (t))
*walk_subtrees = 0; *walk_subtrees = 0;
return NULL; return NULL;
......
2007-02-19 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/self_aggregate_with_call.adb: New test.
2007-02-18 Dorit Nuzman <dorit@il.ibm.com> 2007-02-18 Dorit Nuzman <dorit@il.ibm.com>
PR tree-optimization/30975 PR tree-optimization/30975
-- { dg-do run }
-- { dg-options "-O2" }
procedure self_aggregate_with_call is
type Values is array (1 .. 8) of Natural;
type Vector is record
Components : Values;
end record;
function Clone (Components: Values) return Values is
begin
return Components;
end;
procedure Process (V : in out Vector) is
begin
V.Components (Values'First) := 1;
V := (Components => Clone (V.Components));
if V.Components (Values'First) /= 1 then
raise Program_Error;
end if;
end;
V : Vector;
begin
Process (V);
end;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment