PR95331 - Unlimited polymorphic arrays have wrong bounds.
authorJosé Rui Faustino de Sousa <jrfsousa@gmail.com>
Thu, 11 Jun 2020 13:15:25 +0000 (15:15 +0200)
committerThomas Koenig <tkoenig@gcc.gnu.org>
Thu, 11 Jun 2020 13:16:37 +0000 (15:16 +0200)
commit2ee70f5d161edd99a7af97d166b251bcf83cd91b
tree7ea59277b453d7d8fe0720c0c83f5fbf2233f7f7
parent19019cd3019bbce97bf342e8e574c184e76665b1
PR95331 - Unlimited polymorphic arrays have wrong bounds.

When iterating over a class array use the bounds provided by the
transformed descriptor (in sym->backend_decl) instead of the original
bounds of the array (in the descriptor passed in the class _data)
which are passed in se->expr.

The patch partially depends on the patch for PR52351 and PR85868, but
does not seems to break anything by itself.

gcc/fortran/ChangeLog:

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

PR fortran/95331
* trans-array.c (gfc_conv_array_ref): For class array dummy
arguments use the transformed descriptor in sym->backend_decl
instead of the original descriptor.

gcc/testsuite/ChangeLog:

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

PR fortran/95331
* gfortran.dg/PR95331.f90: New test.
gcc/fortran/trans-array.c
gcc/testsuite/gfortran.dg/PR95331.f90 [new file with mode: 0644]