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.
This commit is contained in:
parent
2e9dfa4bff
commit
5ee5415af8
@ -2407,11 +2407,15 @@ gfc_match_varspec (gfc_expr *primary, int equiv_flag, bool sub_flag,
|
|||||||
component = NULL;
|
component = NULL;
|
||||||
|
|
||||||
if (intrinsic && !inquiry)
|
if (intrinsic && !inquiry)
|
||||||
{
|
{
|
||||||
gfc_error ("%qs at %C is not an inquiry reference to an intrinsic "
|
if (previous)
|
||||||
"type component %qs", name, previous->name);
|
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;
|
return MATCH_ERROR;
|
||||||
}
|
}
|
||||||
else if (component == NULL && !inquiry)
|
else if (component == NULL && !inquiry)
|
||||||
return MATCH_ERROR;
|
return MATCH_ERROR;
|
||||||
|
|
||||||
|
10
gcc/testsuite/gfortran.dg/pr99060.f90
Normal file
10
gcc/testsuite/gfortran.dg/pr99060.f90
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
! { dg-do compile }
|
||||||
|
!
|
||||||
|
! Test the fix for PR99060 in which the expression caused an ICE after the error.
|
||||||
|
!
|
||||||
|
! Contributed by Gerhard Steinmetz <gscfq@t-online.de>
|
||||||
|
!
|
||||||
|
program p
|
||||||
|
real :: a
|
||||||
|
print *, a%kind%n ! { dg-error "not an inquiry reference" }
|
||||||
|
end
|
Loading…
Reference in New Issue
Block a user