PR 35681: Correct handling of "expressions" with ELEMENTAL subroutines
Paul Richard Thomas
paul.richard.thomas@gmail.com
Tue Oct 21 18:37:00 GMT 2008
Hi Daniel,
The reason why I asked you the question about how you were going to
solve this PR was that I wrote all the code to handle elemental
subroutines, including the dependency treatment. I was curious to
know if you had something clever in mind because what I had to write
was a bit of a dog.
> ELEMENTAL call and thus only scalar temporaries are created one at a time
> and not one array temporary, as it should be.
This is why I translated the temporary creation the way that I did.
> Currently there's already logic to handle temporaries (although for the
> INTENT(OUT) arguments) if required for ELEMENTAL calls
> (trans-stmt.c:gfc_conv_elemental_dependencies) and I tried to study the code
> there, but unfortunatelly am not really an expert about trans-time
> scalarization and all those ss/se things.
The testcase in this PR never exercises this bit of code because the
resolved_symbol for MVBITS never gets formal arguments. A very good
start would be to fix this. In addition, you would have to detect
that MVBITS is being handled by trans-call in order to call
gfc_conv_elemental_dependencies. This is because MVBITS is the
exception to the rule about allowing arguments to an elemental
subroutine that can alias.
>
> I also tried a naive patch re-using this logic for the temporaries for
> INTRINSIC_PARENTHESES-expressions but failed because those seem not to get
> an entry into loopse->ss->expr like EXPR_VARIABLE ones seem to do.
Then I think that you should be able to detect INTRINSIC_PARENTHESES
as one way in which temporary creation is triggered; the other being
dependency between the 'TO' argument and any of the others.
> I hope I got it somewhat clear... Any pointer about where I can find
> information on how this scalarization stuff really works and how I can
> achieve this would be very appreciated!
Hah! I tried to write some documentation on this and wrote something
more opaque than the top of trans.c. Start with that and then try
trans_assignment for size....
Good luck - and come back to me if you have any questions.
Cheers
Paul
More information about the Fortran
mailing list