Fortran: Fix same_type_as
authorTobias Burnus <tobias@codesourcery.com>
Thu, 30 Sep 2021 17:08:25 +0000 (19:08 +0200)
committerTobias Burnus <tobias@codesourcery.com>
Thu, 30 Sep 2021 17:08:25 +0000 (19:08 +0200)
commit643e8f4ee3a2a59a9b96fbcd1ffa8bacbda5b383
tree916bf1b74f4268ebf136c97877bf064724b3d6ec
parent8088a33df5f62fd6416fb8cb158b791e639aa707
Fortran: Fix same_type_as

A test for CLASS(*) + assumed rank was missing; adding a test to
unlimited_polymorphic_1.f03 showed an ICE as backend_decl wasn't
set. While gfc_get_symbol_decl would fix it, the code also assumed
that the class(*) was a variable and could not be a subobject of
a derived type.

PR fortran/71703
PR fortran/84007

gcc/fortran/ChangeLog:

* trans-intrinsic.c (gfc_conv_same_type_as): Fix handling
of UNLIMITED_POLY.
* trans.h (gfc_vtpr_hash_get): Renamed prototype to ...
(gfc_vptr_hash_get): ... this to match function name.

gcc/testsuite/ChangeLog:

* gfortran.dg/c-interop/c535b-1.f90: Remove wrong comment.
* gfortran.dg/unlimited_polymorphic_1.f03: Extend.
* gfortran.dg/unlimited_polymorphic_32.f90: New test.
gcc/fortran/trans-intrinsic.c
gcc/fortran/trans.h
gcc/testsuite/gfortran.dg/c-interop/c535b-1.f90
gcc/testsuite/gfortran.dg/unlimited_polymorphic_1.f03
gcc/testsuite/gfortran.dg/unlimited_polymorphic_32.f90 [new file with mode: 0644]