diff options
author | Paul Thomas <pault@gcc.gnu.org> | 2021-02-11 10:38:23 +0000 |
---|---|---|
committer | Paul Thomas <pault@gcc.gnu.org> | 2021-02-11 10:38:23 +0000 |
commit | 5ee5415af8691640b0f7a5332b78d04ba309f4f0 (patch) | |
tree | 0a67e473c515561c8c9f07998009f7d289bb296c /gcc/fortran/primary.c | |
parent | 2e9dfa4bff267913654bd5f2c3b5efc1b1268a2e (diff) | |
download | gcc-5ee5415af8691640b0f7a5332b78d04ba309f4f0.zip gcc-5ee5415af8691640b0f7a5332b78d04ba309f4f0.tar.gz gcc-5ee5415af8691640b0f7a5332b78d04ba309f4f0.tar.bz2 |
Fortran: Fix ICE after error regression [PR99060].
2021-02-11 Paul Thomas <pault@gcc.gnu.org>
gcc/fortran
PR fortran/99060
* primary.c (gfc_match_varspec): Test for non-null 'previous'
before using its name in the error message.
gcc/testsuite/
PR fortran/99060
* gfortran.dg/pr99060.f90: New test.
Diffstat (limited to 'gcc/fortran/primary.c')
-rw-r--r-- | gcc/fortran/primary.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/gcc/fortran/primary.c b/gcc/fortran/primary.c index d0610d0..7633e77 100644 --- a/gcc/fortran/primary.c +++ b/gcc/fortran/primary.c @@ -2407,11 +2407,15 @@ gfc_match_varspec (gfc_expr *primary, int equiv_flag, bool sub_flag, component = NULL; if (intrinsic && !inquiry) - { - gfc_error ("%qs at %C is not an inquiry reference to an intrinsic " - "type component %qs", name, previous->name); + { + if (previous) + gfc_error ("%qs at %C is not an inquiry reference to an intrinsic " + "type component %qs", name, previous->name); + else + gfc_error ("%qs at %C is not an inquiry reference to an intrinsic " + "type component", name); return MATCH_ERROR; - } + } else if (component == NULL && !inquiry) return MATCH_ERROR; |