Andrew Pinski wrote:
> > I have been experimenting with a simple patch adding side effects
> > checks to the conditions, like "! TREE_SIDE_EFFECTS (value)"
> > in init_ctor_eval
> 
> Yes the one in needs to gimplify only the expression as a statement
> and not add a modify statement.  More on the testcase later.

> You should not need the check in modify_expr as the side effects are
> never mishandled as we always will add the lhs and rhs to the
> instruction stream:

 Oh, I see - misread what it did. Thanks.

 I was confused by the fact that the check in init_ctor_eval did not
 help for C while it did for Ada.

 It actually doesn't change the behavior for C (at least on my testcases)
 because we don't get into init_ctor_eval at all, but in gimplify_expr
 <case CONSTRUCTOR_EXPR> instead, which precisely processes values with
 TREE_SIDE_EFFECTS set.

 I'm not yet clear why the call is not issued there. This is my first
 dive in the gimplifier, so it might well be simple.

> Here is a testcase which should pass:
...

 It doesn't pass with the init_ctor_eval check either.

> If you want me to file a bug, I can, I can also look into the issue
> some too and figure out where the f++ is going to.

 Either is fine with me (thanks for the offer :).

 On my side, I will test again with only the init_ctor_eval change and
 submit on gcc-patches with an Ada testcase.

 The only regressions I had with the two changes were the ICEs on 
 zero-strct-4.c. I don't see them with the modify_expr change removed,
 so hopefully the second round will go well.

> Note if we change struct g to be a non zero sized struct, it works.

 Indeed.

 Thanks for your feedback.

 Olivier

 

Reply via email to