Wrong array section bounds when passing to an intent-in pointer dummy.
authorJosé Rui Faustino de Sousa <jrfsousa@gmail.com>
Thu, 11 Jun 2020 12:14:30 +0000 (14:14 +0200)
committerThomas Koenig <tkoenig@gcc.gnu.org>
Thu, 11 Jun 2020 12:21:38 +0000 (14:21 +0200)
commit2ff0f48819c8a7ed5d7c03e2bfc02e5907e2ff1a
tree8611f3116771c0354cd998a6ccda002912d0475d
parentbe11812eef33786f77676327667bf3885c1f33e8
Wrong array section bounds when passing to an intent-in pointer dummy.

Add code to allow for the creation a new descriptor for array
sections with the correct one based indexing.

Rework the generated descriptors indexing (hopefully) fixing the
wrong offsets generated.

gcc/fortran/ChangeLog:

2020-06-11  José Rui Faustino de Sousa  <jrfsousa@gmail.com>

PR fortran/52351
PR fortran/85868
* trans-array.c (gfc_conv_expr_descriptor): Enable the
creation of a new descriptor with the correct one based
indexing for array sections.  Rework array descriptor
indexing offset calculation.

gcc/testsuite/ChangeLog:

2020-06-11  José Rui Faustino de Sousa  <jrfsousa@gmail.com>

PR fortran/52351
PR fortran/85868
* gfortran.dg/coarray_lib_comm_1.f90: Adjust match test for
the newly generated descriptor.
* gfortran.dg/PR85868A.f90: New test.
* gfortran.dg/PR85868B.f90: New test.
gcc/fortran/trans-array.c
gcc/testsuite/gfortran.dg/PR85868A.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/PR85868B.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/coarray_lib_comm_1.f90