This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] handle zero-sized constructor component if side effects
Daniel Berlin wrote:
> Again, this is not quite what you want to do.
> This will cause you bugs, because nothing expects to see sets of zero
> sized fields, and it confuses things like subvars, regardless of whether
> they have side effects or not.
>
> We should still throw the set away, we just need to execute the
> instructions in the constructor.
> You should be doing what gimplify_modify_expr does, which is to still
> place the *value* side of the constructor in the instruction stream,
> just don't assign it to anything.
Humm, something like that:
/* For zero-sized fields, just add the value to the statement list if
there are side-effects and continue. This can happen with calls to
functions returning a zero-sized type, which we shouldn't discard.
We must not emit an assignment in this case, as nothing expects to
see sets of zero sized fields downstream. */
if (zero_sized_field_decl (purpose))
{
if (TREE_SIDE_EFFECTS (value))
gimplify_and_add (value, pre_p);
continue;
}
?
Thanks for your feedback,
Olivier