Use CHARACTER(kind) string for calculating the type hash.
authorThomas Koenig <tkoenig@gcc.gnu.org>
Tue, 30 Jun 2020 11:01:36 +0000 (13:01 +0200)
committerThomas Koenig <tkoenig@gcc.gnu.org>
Tue, 30 Jun 2020 11:10:20 +0000 (13:10 +0200)
commit5958b926dcc3332aec0a2e34653c4394d2613401
treea883a14d091366ae9442362f8ec6d327b0e469de
parent8dc933c12f489626339b3ba1a8e2dc23eb4de98e
Use CHARACTER(kind) string for calculating the type hash.

This regression came about because of a change in the way
types are displayed in error messages.  The character
representation is also used to calculate the hashes for
our types, so this patch restores the old behavior if
we are indeed calculating a hash.

The test case also checks for the specific hash value because
changing that would be an ABI change, which we should not
be doing unintentionally.

gcc/fortran/ChangeLog:

2020-06-30  Thomas Koenig  <tkoenig@gcc.gnu.org>

PR fortran/95355
* gfortran.h (gfc_typename): Add optional argument for_hash.
* misc.c (gfc_typename): When for_hash is true, just retur
  CHARACTER(kind).
* class.c (gfc_intrinsic_hash_value): Call gfc_typename with
  for_hash = true.
gcc/fortran/class.c
gcc/fortran/gfortran.h
gcc/fortran/misc.c
gcc/testsuite/gfortran.dg/select_type_49.f90 [new file with mode: 0644]