aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran
diff options
context:
space:
mode:
authorPaul Thomas <pault@gcc.gnu.org>2020-08-02 10:35:36 +0100
committerGiuliano Belinassi <giuliano.belinassi@usp.br>2020-08-17 13:20:34 -0300
commit1f99cd039fdce224b6b413e7dbeb0c45ffc61253 (patch)
treeac1659e92867d03fa078b9bd3dde06f620d15a6e /gcc/fortran
parent39adaee5a488cdf77d172647b4962c321a8e94a5 (diff)
downloadgcc-1f99cd039fdce224b6b413e7dbeb0c45ffc61253.zip
gcc-1f99cd039fdce224b6b413e7dbeb0c45ffc61253.tar.gz
gcc-1f99cd039fdce224b6b413e7dbeb0c45ffc61253.tar.bz2
This patch fixes PR96325. See the explanatory comment in the testcase.
2020-08-02 Paul Thomas <pault@gcc.gnu.org> gcc/fortran PR fortran/96325 * primary.c (gfc_match_varspec): In the case that a component reference is added to an intrinsic type component, emit the error message in this function. gcc/testsuite/ PR fortran/96325 * gfortran.dg/pr96325.f90: New test. * gfortran.dg/pr91589.f90: Update error message.
Diffstat (limited to 'gcc/fortran')
-rw-r--r--gcc/fortran/primary.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/gcc/fortran/primary.c b/gcc/fortran/primary.c
index c0f66d3..a58a259 100644
--- a/gcc/fortran/primary.c
+++ b/gcc/fortran/primary.c
@@ -2023,7 +2023,8 @@ gfc_match_varspec (gfc_expr *primary, int equiv_flag, bool sub_flag,
{
char name[GFC_MAX_SYMBOL_LEN + 1];
gfc_ref *substring, *tail, *tmp;
- gfc_component *component;
+ gfc_component *component = NULL;
+ gfc_component *previous = NULL;
gfc_symbol *sym = primary->symtree->n.sym;
gfc_expr *tgt_expr = NULL;
match m;
@@ -2343,15 +2344,19 @@ gfc_match_varspec (gfc_expr *primary, int equiv_flag, bool sub_flag,
break;
}
+ previous = component;
+
if (!inquiry && !intrinsic)
component = gfc_find_component (sym, name, false, false, &tmp);
else
component = NULL;
- /* In some cases, returning MATCH_NO gives a better error message. Most
- cases return "Unclassifiable statement at..." */
if (intrinsic && !inquiry)
- return MATCH_NO;
+ {
+ gfc_error ("%qs at %C is not an inquiry reference to an intrinsic "
+ "type component %qs", name, previous->name);
+ return MATCH_ERROR;
+ }
else if (component == NULL && !inquiry)
return MATCH_ERROR;