diff options
Diffstat (limited to 'gcc/fortran/primary.c')
-rw-r--r-- | gcc/fortran/primary.c | 44 |
1 files changed, 35 insertions, 9 deletions
diff --git a/gcc/fortran/primary.c b/gcc/fortran/primary.c index d738984..a58a259 100644 --- a/gcc/fortran/primary.c +++ b/gcc/fortran/primary.c @@ -432,8 +432,8 @@ match_boz_constant (gfc_expr **result) goto backup; if (x_hex - && gfc_invalid_boz ("Hexadecimal constant at %L uses " - "nonstandard X instead of Z", &gfc_current_locus)) + && gfc_invalid_boz (G_("Hexadecimal constant at %L uses " + "nonstandard X instead of Z"), &gfc_current_locus)) return MATCH_ERROR; old_loc = gfc_current_locus; @@ -470,8 +470,8 @@ match_boz_constant (gfc_expr **result) goto backup; } - if (gfc_invalid_boz ("BOZ constant at %C uses nonstandard postfix " - "syntax", &gfc_current_locus)) + if (gfc_invalid_boz (G_("BOZ constant at %C uses nonstandard postfix " + "syntax"), &gfc_current_locus)) return MATCH_ERROR; } @@ -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; @@ -2245,6 +2246,27 @@ gfc_match_varspec (gfc_expr *primary, int equiv_flag, bool sub_flag, { if (tmp) { + switch (tmp->u.i) + { + case INQUIRY_RE: + case INQUIRY_IM: + if (!gfc_notify_std (GFC_STD_F2008, + "RE or IM part_ref at %C")) + return MATCH_ERROR; + break; + + case INQUIRY_KIND: + if (!gfc_notify_std (GFC_STD_F2003, + "KIND part_ref at %C")) + return MATCH_ERROR; + break; + + case INQUIRY_LEN: + if (!gfc_notify_std (GFC_STD_F2003, "LEN part_ref at %C")) + return MATCH_ERROR; + break; + } + if ((tmp->u.i == INQUIRY_RE || tmp->u.i == INQUIRY_IM) && primary->ts.type != BT_COMPLEX) { @@ -2322,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; @@ -2576,7 +2602,7 @@ gfc_variable_attr (gfc_expr *expr, gfc_typespec *ts) sym = expr->symtree->n.sym; attr = sym->attr; - if (sym->ts.type == BT_CLASS && sym->attr.class_ok) + if (sym->ts.type == BT_CLASS && sym->attr.class_ok && sym->ts.u.derived) { dimension = CLASS_DATA (sym)->attr.dimension; codimension = CLASS_DATA (sym)->attr.codimension; |