Dear FX,

I am puzzled by this business of the SAVE_EXPR:

First, I agree entirely that it is a mystery as to why the SAVE_EXPR
appears. It does not do so for array elements nor for arrays.

Secondly, as far as I can tell, SAVE_EXPR_RESOLVED_P(…) merely implies
that a pointer to a tree is returned. In fact, it does not seem to
signify a usless expression since, in one case in trans-decl.c, it is
actually used.

Third, I do not see where the side effects will appear. Although this
is a co-array element, assignment to it is a purely local affair. It
has to be explicitly referenced from another process before
communication occurs, does it not? This is where my ignorance surfaces
in full force, however :-(

I don't know what to do with this, other than to dereference a tree
pointer if that appears. Ideally, the SAVE_EXPR should be suppressed
at source, although I do not know how to accomplish that.

I would bemore than happy to act on advice from other maintainers....

Cheers

Paul

On 8 September 2015 at 23:02, FX <fxcoud...@gmail.com> wrote:
>> This is something of a corner case, where gfc_conv_expr comes back
>> with a SAVE_EXPR, in the case of complex, scalar, coarray lvalues. The
>> first field of the SAVE_EXPR is a perfectly viable expression to
>> assign to, so I have taken that. If anybody out there has a better
>> solution, please speak up!
>
> If the SAVE_EXPR is a useless one, it should have SAVE_EXPR_RESOLVED_P(…) be 
> true. Then you can simply discard it as you’re doing.
> If not, we need to created a temp variable, as simply removing the SAVE_EXPR 
> will lead to multiple side-effects evalution in some cases otherwise.
>
> But I’m curious as to where the SAVE_EXPR is created. As far as I can tell, 
> all SAVE_EXPR in our front-end are created by explicit calls to save_expr(), 
> of which there are very few. I don’t see which one is the culprit here :(  
> But creating a SAVE_EXPR for a LHS is definitely not a good idea in the first 
> place.
>
> FX
>
>



-- 
Outside of a dog, a book is a man's best friend. Inside of a dog it's
too dark to read.

Groucho Marx

Reply via email to