re PR fortran/91589 (ICE in gfc_conv_component_ref, at fortran/trans-expr.c:2447)
2019-09-02 Paul Thomas <pault@gcc.gnu.org> PR fortran/91589 * primary.c (gfc_match_varspec): Return MATCH_NO on an apparent component ref, when the primary type is intrinsic. 2019-09-02 Paul Thomas <pault@gcc.gnu.org> PR fortran/91589 * gfortran.dg/pr91589.f90 : New test. From-SVN: r275324
This commit is contained in:
parent
be0fb5484a
commit
f79be3a7db
@ -1,3 +1,9 @@
|
||||
2019-09-02 Paul Thomas <pault@gcc.gnu.org>
|
||||
|
||||
PR fortran/91589
|
||||
* primary.c (gfc_match_varspec): Return MATCH_NO on an apparent
|
||||
component ref, when the primary type is intrinsic.
|
||||
|
||||
2019-09-02 Steven G. Kargl <kargl@gc.gnu.org>
|
||||
|
||||
PR fortran/91552
|
||||
|
@ -2028,6 +2028,7 @@ gfc_match_varspec (gfc_expr *primary, int equiv_flag, bool sub_flag,
|
||||
match m;
|
||||
bool unknown;
|
||||
bool inquiry;
|
||||
bool intrinsic;
|
||||
locus old_loc;
|
||||
char sep;
|
||||
|
||||
@ -2232,11 +2233,15 @@ gfc_match_varspec (gfc_expr *primary, int equiv_flag, bool sub_flag,
|
||||
if (m != MATCH_YES)
|
||||
return MATCH_ERROR;
|
||||
|
||||
intrinsic = false;
|
||||
if (primary->ts.type != BT_CLASS && primary->ts.type != BT_DERIVED)
|
||||
{
|
||||
inquiry = is_inquiry_ref (name, &tmp);
|
||||
if (inquiry)
|
||||
sym = NULL;
|
||||
|
||||
if (sep == '%' && primary->ts.type != BT_UNKNOWN)
|
||||
intrinsic = true;
|
||||
}
|
||||
else
|
||||
inquiry = false;
|
||||
@ -2296,12 +2301,16 @@ gfc_match_varspec (gfc_expr *primary, int equiv_flag, bool sub_flag,
|
||||
break;
|
||||
}
|
||||
|
||||
if (!inquiry)
|
||||
if (!inquiry && !intrinsic)
|
||||
component = gfc_find_component (sym, name, false, false, &tmp);
|
||||
else
|
||||
component = NULL;
|
||||
|
||||
if (component == NULL && !inquiry)
|
||||
/* In some cases, returning MATCH_NO gives a better error message. Most
|
||||
cases return "Unclassifiable statement at..." */
|
||||
if (intrinsic && !inquiry)
|
||||
return MATCH_NO;
|
||||
else if (component == NULL && !inquiry)
|
||||
return MATCH_ERROR;
|
||||
|
||||
/* Extend the reference chain determined by gfc_find_component or
|
||||
@ -2598,7 +2607,7 @@ gfc_variable_attr (gfc_expr *expr, gfc_typespec *ts)
|
||||
|
||||
case AR_UNKNOWN:
|
||||
/* For standard conforming code, AR_UNKNOWN should not happen.
|
||||
For nonconforming code, gfortran can end up here. Treat it
|
||||
For nonconforming code, gfortran can end up here. Treat it
|
||||
as a no-op. */
|
||||
break;
|
||||
}
|
||||
|
@ -1,3 +1,8 @@
|
||||
2019-09-02 Paul Thomas <pault@gcc.gnu.org>
|
||||
|
||||
PR fortran/91589
|
||||
* gfortran.dg/pr91589.f90 : New test.
|
||||
|
||||
2019-09-02 Steven G. Kargl <kargl@gc.gnu.org>
|
||||
|
||||
PR fortran/91552
|
||||
|
15
gcc/testsuite/gfortran.dg/pr91589.f90
Normal file
15
gcc/testsuite/gfortran.dg/pr91589.f90
Normal file
@ -0,0 +1,15 @@
|
||||
! { dg-do compile }
|
||||
!
|
||||
! Check the fix for PR91589, in which the invalid expression caused an ICE.
|
||||
! Other statements using this invalid expression cause "Unclassifiable statement at..."
|
||||
!
|
||||
! Contributed by Gerhardt Steinmetz <gscfq@t-online.de>
|
||||
!
|
||||
program p
|
||||
type t
|
||||
integer :: a
|
||||
end type
|
||||
type(t) :: x = t(1)
|
||||
call sub (x%a%a) ! { dg-error "Syntax error in argument list" }
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user