On 10/20/21 01:58, Uecker, Martin wrote:
Am Montag, den 18.10.2021, 12:35 -0400 schrieb Jason Merrill:
On 10/17/21 09:52, Uecker, Martin wrote:

Here is the 4th version of the patch. I tried to implement
Jason's suggestion and this also fixes the problem. But
I am not sure I understand the condition on
the TREE_SIDE_EFFECTS ...

Checking TREE_SIDE_EFFECTS filters out many trivial cases that we don't
need to worry about.

Yes, but are we sure there are always side effects in the
cases we care about? I assume that the problematic case
are only those where the size expression depends on a
variable and then there was a write to one.. But I am not
sure.

The problematic case should always involve a SAVE_EXPR or TARGET_EXPR, which has TREE_SIDE_EFFECTS.

I think we also want to check
variably_modified_type_p, which ought to avoid the OMP problem below.

I don't think so because the problem below involves VM types.

Ah, true.

And there is now another problem:

c_finish_omp_for in c-family/c-omp.c does not seem
to understand the expressions anymore and I get a test
failure in

testsuite/c-c++-common/gomp/for-5.c

where I now get an "invalid increment expression"
instead of the expected error.
(bootstrapping and all other tests work fine)

Ah, yes, because the variable size is still wrapped in a SAVE_EXPR even if the inner expression is just a variable reference.

I think we only want to do this transformation if size_exp involves a BIND_EXPR.

And probably do it sooner, changing size_exp rather than intop.

Jason

Reply via email to