Fortran : ICE on invalid code PR95398
authorMark Eggleston <markeggleston@gcc.gnu.org>
Mon, 1 Jun 2020 07:15:31 +0000 (08:15 +0100)
committerMark Eggleston <markeggleston@gcc.gnu.org>
Tue, 1 Sep 2020 09:57:05 +0000 (10:57 +0100)
commit3d137b75febd1a4ad70bcc64e0f79198f5571b86
treecc417a6b086517635abe9ee0a8373abf575b0c5f
parentd6a05b494b4b714e996a5ca09c5a4a1c41dbd648
Fortran  : ICE on invalid code PR95398

The CLASS_DATA macro is used to shorten the code accessing the derived
components of an expressions type specification.  If the type is not
BT_CLASS the derived pointer is NULL resulting in an ICE.  To avoid
dereferencing a NULL pointer the type should be BT_CLASS.

2020-09-01  Steven G. Kargl  <kargl@gcc.gnu.org>

gcc/fortran

PR fortran/95398
* resolve.c (resolve_select_type): Add check for BT_CLASS
type before using the CLASS_DATA macro which will have a
NULL pointer to derive components if it isn't BT_CLASS.

2020-09-01  Mark Eggleston  <markeggleston@gcc.gnu.org>

gcc/testsuite

PR fortran/95398
* gfortran.dg/pr95398.f90: New test.
gcc/fortran/resolve.c
gcc/testsuite/gfortran.dg/pr95398.f90 [new file with mode: 0644]