aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/parse.cc
diff options
context:
space:
mode:
authorSteve Kargl <kargl@gcc.gnu.org>2022-12-26 14:07:04 -0800
committerJerry DeLisle <jvdelisle@gcc.gnu.org>2022-12-29 19:25:17 -0800
commitcdc6bf44eec295805ae29a8aaddafd111de01c8e (patch)
treee3a00ce5b53e7370e25cd9ee0af8618c46ffd756 /gcc/fortran/parse.cc
parentbbab9c83f27cf15b861b34f2900e570c065dfc07 (diff)
downloadgcc-cdc6bf44eec295805ae29a8aaddafd111de01c8e.zip
gcc-cdc6bf44eec295805ae29a8aaddafd111de01c8e.tar.gz
gcc-cdc6bf44eec295805ae29a8aaddafd111de01c8e.tar.bz2
Modify checks to avoid referencing NULL pointer.
Update test cases with error messages that changed as a result. gcc/fortran/ChangeLog: PR fortran/102595 * decl.cc (attr_decl1): Guard against NULL pointer. * parse.cc (match_deferred_characteristics): Include BT_CLASS in check for derived being undefined. gcc/testsuite/ChangeLog: PR fortran/102595 * gfortran.dg/class_result_4.f90: Update error message check. * gfortran.dg/pr85779_3.f90: Update error message check.
Diffstat (limited to 'gcc/fortran/parse.cc')
-rw-r--r--gcc/fortran/parse.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/gcc/fortran/parse.cc b/gcc/fortran/parse.cc
index bc2b218..6186c48 100644
--- a/gcc/fortran/parse.cc
+++ b/gcc/fortran/parse.cc
@@ -3934,7 +3934,7 @@ match_deferred_characteristics (gfc_typespec * ts)
m = gfc_match_prefix (ts);
gfc_buffer_error (false);
- if (ts->type == BT_DERIVED)
+ if (ts->type == BT_DERIVED || ts->type == BT_CLASS)
{
ts->kind = 0;
@@ -4215,7 +4215,7 @@ declSt:
if (bad_characteristic)
{
ts = &gfc_current_block ()->result->ts;
- if (ts->type != BT_DERIVED)
+ if (ts->type != BT_DERIVED && ts->type != BT_CLASS)
gfc_error ("Bad kind expression for function %qs at %L",
gfc_current_block ()->name,
&gfc_current_block ()->declared_at);