diff options
author | Steven G. Kargl <kargl@gcc.gnu.org> | 2011-10-20 17:04:53 +0000 |
---|---|---|
committer | Steven G. Kargl <kargl@gcc.gnu.org> | 2011-10-20 17:04:53 +0000 |
commit | fc3c9491097e937cbd6d0bc07d15fa39abc590d6 (patch) | |
tree | 54f89e46f8abcee8c7d6e468834785423c36258a /gcc/fortran/io.c | |
parent | 24685ae9c5884ce29dacd06ed3673ae57ed3b4df (diff) | |
download | gcc-fc3c9491097e937cbd6d0bc07d15fa39abc590d6.zip gcc-fc3c9491097e937cbd6d0bc07d15fa39abc590d6.tar.gz gcc-fc3c9491097e937cbd6d0bc07d15fa39abc590d6.tar.bz2 |
2011-10-16 Steven G. Kargl<kargl@gcc.gnu.org>
* io.c (match_dt_format): Match a user-defined operator or a kind
type prefixed string.
2011-10-16 Steven G. Kargl<kargl@gcc.gnu.org>
* gfortran.dg/format_string.f: New test.
From-SVN: r180261
Diffstat (limited to 'gcc/fortran/io.c')
-rw-r--r-- | gcc/fortran/io.c | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/gcc/fortran/io.c b/gcc/fortran/io.c index 58c942f..a291bb8 100644 --- a/gcc/fortran/io.c +++ b/gcc/fortran/io.c @@ -2548,17 +2548,31 @@ match_dt_format (gfc_dt *dt) if ((m = gfc_match_st_label (&label)) == MATCH_YES) { - if (dt->format_expr != NULL || dt->format_label != NULL) + char c; + + /* Need to check if the format label is actually either an operand + to a user-defined operator or is a kind type parameter. That is, + print 2.ip.8 ! .ip. is a user-defined operator return CHARACTER. + print 1_'(I0)', i ! 1_'(I0)' is a default character string. */ + + gfc_gobble_whitespace (); + c = gfc_peek_ascii_char (); + if (c == '.' || c == '_') + gfc_current_locus = where; + else { - gfc_free_st_label (label); - goto conflict; - } + if (dt->format_expr != NULL || dt->format_label != NULL) + { + gfc_free_st_label (label); + goto conflict; + } - if (gfc_reference_st_label (label, ST_LABEL_FORMAT) == FAILURE) - return MATCH_ERROR; + if (gfc_reference_st_label (label, ST_LABEL_FORMAT) == FAILURE) + return MATCH_ERROR; - dt->format_label = label; - return MATCH_YES; + dt->format_label = label; + return MATCH_YES; + } } else if (m == MATCH_ERROR) /* The label was zero or too large. Emit the correct diagnosis. */ |