fortran: Update index extraction code. [PR102043]
authorMikael Morin <mikael@gcc.gnu.org>
Fri, 22 Apr 2022 20:52:26 +0000 (22:52 +0200)
committerMikael Morin <mikael@gcc.gnu.org>
Fri, 22 Apr 2022 20:52:26 +0000 (22:52 +0200)
commite72fbb6915c1dd1a52ecef55e10329e353cc3072
tree15791c0b35c94c7d7a99bd0ed8e19938674ab764
parent89ca0fffa48b799b228beee48a16e26e24d8e199
fortran: Update index extraction code. [PR102043]

This avoids a regression on hollerith4.f90 and hollerith6.f90 later in
the patch series when code generation for array references is changed
to use pointer arithmetic.

The problem comes from the extraction of the array index from an
ARRAY_REF tree, which doesn’t work if the tree is not an ARRAY_REF
any more.

This updates the code generated for remaining size evaluation to work
with a source tree that uses either array indexing or pointer
arithmetic.

PR fortran/102043

gcc/fortran/ChangeLog:

* trans-io.cc: Add handling for the case where the array
is referenced using pointer arithmetic.
gcc/fortran/trans-io.cc