This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: question about elemental subroutines


Brooks,

I should correct myself, however, on one point: This has nothing to do with whether the non-expression argument is OUT or INOUT. Thus, the patch
itself appears correct, and I retract my disagreement with it. However,
it does seem odd to me that the patch appears to resolve this by making
a temporary for the INOUT variable rather than the IN variable, as that
requires two copies rather than one.


I am now totally convinced that it is only the assignment that should be the subject of dependency checking and this is what I will prepare for resubmission. It's a pity about the effort that went into the writing and debugging of that patch but never mind!

I have checked what other compilers do; one well known brand does not get the assignment right, whilst none of the others do any more; thus confirming your original reaction.

It was suggested that using parentheses should assure the creation of array temporaries. Well, the standard does not require this; parentheses assure the order of computation of an expression. Thus the parameter of an elemental subroutine is calculated and put in a SCALAR temporary. This is consistent with efficiency requirements.

In revamping this patch, I had thought to use the parentheses operator, as I have for the fix of PR27411, but, for the reason just described, this does not work. It would be straightforward to write an operator for internal use that does this. Then the need for a temporary could be detected and treated in the frontend, thus simplifying the middle-end. What do people think of this? As well as the expression, it could be arranged that op2 is the INTENT, to cover the range of possible needs.

Paul



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]