aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/match.c
diff options
context:
space:
mode:
authorSteven G. Kargl <kargl@gcc.gnu.org>2018-02-07 20:43:33 +0000
committerSteven G. Kargl <kargl@gcc.gnu.org>2018-02-07 20:43:33 +0000
commit52b16cb3d48a328c9cdaa0ca55c151066ec65e4d (patch)
treea754eae490553a484687b24ac6a9c97daedf384e /gcc/fortran/match.c
parentf320fdfd22463a969024c05347dc9fc24291296a (diff)
downloadgcc-52b16cb3d48a328c9cdaa0ca55c151066ec65e4d.zip
gcc-52b16cb3d48a328c9cdaa0ca55c151066ec65e4d.tar.gz
gcc-52b16cb3d48a328c9cdaa0ca55c151066ec65e4d.tar.bz2
re PR fortran/82049 (ICE with character(*),parameter array constructor)
2018-02-06 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/82049 * match.c (gfc_match_type_spec): If the charlen is non-NULL, then try to resolve it. While here return early if possible. 2018-02-06 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/82049 * gfortran.dg/assumed_charlen_parameter.f90: New test. From-SVN: r257459
Diffstat (limited to 'gcc/fortran/match.c')
-rw-r--r--gcc/fortran/match.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/gcc/fortran/match.c b/gcc/fortran/match.c
index cf44fab..7bce34b 100644
--- a/gcc/fortran/match.c
+++ b/gcc/fortran/match.c
@@ -2054,11 +2054,17 @@ gfc_match_type_spec (gfc_typespec *ts)
{
match m;
locus old_locus;
- char name[GFC_MAX_SYMBOL_LEN + 1];
+ char c, name[GFC_MAX_SYMBOL_LEN + 1];
gfc_clear_ts (ts);
gfc_gobble_whitespace ();
old_locus = gfc_current_locus;
+
+ /* If c isn't [a-z], then return immediately. */
+ c = gfc_peek_ascii_char ();
+ if (!ISALPHA(c))
+ return MATCH_NO;
+
type_param_spec_list = NULL;
if (match_derived_type_spec (ts) == MATCH_YES)
@@ -2099,6 +2105,8 @@ gfc_match_type_spec (gfc_typespec *ts)
ts->type = BT_CHARACTER;
m = gfc_match_char_spec (ts);
+ if (ts->u.cl && ts->u.cl->length)
+ gfc_resolve_expr (ts->u.cl->length);
if (m == MATCH_NO)
m = MATCH_YES;