[Patch, fortran] [05..09/14] Support coarray subreferences: Add support for array elements.
Mikael Morin
mikael.morin@sfr.fr
Fri Oct 7 14:39:00 GMT 2011
The walk_coarray function introduced at
http://gcc.gnu.org/ml/fortran/2011-09/msg00074.html doesn't (like the code it
replaces) support subreferences after the coarray.
These patches are going to change that.
- The first step is, while looking for the coarray reference, to really look for
it, instead of walking blindly to the last ref (patch 7).
- Then, in the code generated, an offset to the full array has to be added,
corresponding to the subreference.
The path taken is to reuse the scalarizer initialization handling for array
sections subreferences in gfc_walk_variable_expr, and then let the rest
of the scalarizer do the right thing with that (patch 9).
- For that to work, we need to skip the array ref lookup in
gfc_walk_variable_expr, which is not valid for coarrays. A new funtion
gfc_walk_array_ref is introduced, containing all of gfc_walk_variable_expr's
code but the array ref lookup (patch 5).
- Then for array elements (like coarray(1,1)), we change them from AR_ELEMENT
to AR_SECTION so that they get the same treatment as normal arrays in
gfc_walk_array_ref (patch 8).
- There is a small problem with the latter change; there is an assertion in
gfc_walk_array_ref that in the AR_SECTION case, rank is non-zero.
Patch 6 fixes that.
OK?
PS: The patch numbering is odd, because I have tried to reorder patches so that
no regression is introduced. However, I haven't checked that it is actually the
case. All I know is at the end, it's fine. ;-)
-------------- next part --------------
2011-10-06 Mikael Morin <mikael.morin@sfr.fr>
* trans-array.h (gfc_walk_array_ref): New prototype.
* trans-array.c (gfc_walk_array_ref): New function, containing
all but the beginning of gfc_walk_variable_expr's code.
(gfc_walk_variable_expr): Use gfc_walk_array_ref.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr50420-5.diff
Type: text/x-diff
Size: 1240 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20111007/be935b30/attachment.bin>
-------------- next part --------------
2011-10-06 Mikael Morin <mikael.morin@sfr.fr>
PR fortran/50420
* trans-array.c (gfc_walk_array_ref): Allow zero rank arrays
if they are coarrays.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr50420-6.diff
Type: text/x-diff
Size: 607 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20111007/be935b30/attachment-0001.bin>
-------------- next part --------------
2011-10-06 Mikael Morin <mikael.morin@sfr.fr>
PR fortran/50420
* trans-intrinsic.c (walk_coarray): Allow subreferences after a
coarray object reference.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr50420-7.diff
Type: text/x-diff
Size: 621 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20111007/be935b30/attachment-0002.bin>
-------------- next part --------------
2011-10-06 Mikael Morin <mikael.morin@sfr.fr>
PR fortran/50420
* trans-intrinsic.c (walk_coarray): Change AR_ELEMENT to AR_SECTION.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr50420-8.diff
Type: text/x-diff
Size: 361 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20111007/be935b30/attachment-0003.bin>
-------------- next part --------------
2011-10-06 Mikael Morin <mikael.morin@sfr.fr>
PR fortran/50420
* trans-intrinsic.c (walk_coarray): Use gfc_walk_array_ref for
the scalarization chain initialization.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr50420-9.diff
Type: text/x-diff
Size: 593 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20111007/be935b30/attachment-0004.bin>
More information about the Fortran
mailing list