[PATCH] Fix gimplification bug with constructors
Eric Botcazou
ebotcazou@adacore.com
Thu Nov 23 12:41:00 GMT 2006
Hi,
This is a regression present in the 4.x series of Ada compilers.
For
V := (Components => Clone (V.Components));
we have in .original
*v = {.components=p__clone ((natural___XDLU_0__2147483647[1:8] &)
&v->components)};
and in .gimple
D.1025 = &v->components;
*v = {};
v->components = p__clone (D.1025) [return slot optimization];
Now "Clone" dereferences its argument:
P.Clone (components)
{
<retval> = *components;
return <retval>;
}
so the block-clearing effectively clobbers the argument of "Clone".
It turns out that gimplify_init_ctor_preeval_1 already has a provision for
"visible" dereferences within constructors:
/* If the constructor component is indirect, determine if we have a
potential overlap with the lhs. The only bits of information we
have to go on at this point are addressability and alias sets. */
if (TREE_CODE (t) == INDIRECT_REF
&& (!data->lhs_base_decl || TREE_ADDRESSABLE (data->lhs_base_decl))
&& alias_sets_conflict_p (data->lhs_alias_set, get_alias_set (t)))
return t;
Here we have a "hidden" dereference, but we can still check the type of the
parameters of the function.
Bootstrapped/regtested on i586-suse-linux, OK for mainline/4.2/4.1 branches?
2006-11-23 Eric Botcazou <ebotcazou@adacore.com>
* gimplify.c (gimplify_init_ctor_preeval_1): Detect potential overlap
due to calls to functions taking pointers as parameters.
2006-11-23 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/self_aggregate_with_call.adb: New test.
:ADDPATCH gimplifier:
--
Eric Botcazou
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fb20-014_fsf.diff
Type: text/x-diff
Size: 980 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20061123/c96407dd/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: self_aggregate_with_call.adb
Type: text/x-adasrc
Size: 579 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20061123/c96407dd/attachment-0001.bin>
More information about the Gcc-patches
mailing list