diff options
author | fxcoudert <fxcoudert@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-11-17 00:10:00 +0000 |
---|---|---|
committer | fxcoudert <fxcoudert@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-11-17 00:10:00 +0000 |
commit | c32512708bd6f7c6d45e8bda47f58af31de45d8b (patch) | |
tree | e39dc3e0dc7b62e6ca0d7390fcbbeac8a70a3e01 /gcc/fortran/io.c | |
parent | 82785173423282359d2a504d1dcfedf027891992 (diff) | |
download | gcc-c32512708bd6f7c6d45e8bda47f58af31de45d8b.tar.gz |
PR fortran/34108
* io.c (check_format_string): Only check character expressions.
(match_dt_format): Return MATCH_ERROR if that is what
gfc_match_st_label said.
* gfortran.dg/fmt_label_1.f90: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@130249 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran/io.c')
-rw-r--r-- | gcc/fortran/io.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/gcc/fortran/io.c b/gcc/fortran/io.c index 0e2a0cb7df2..bb4295b866a 100644 --- a/gcc/fortran/io.c +++ b/gcc/fortran/io.c @@ -919,7 +919,7 @@ finished: static try check_format_string (gfc_expr *e, bool is_input) { - if (!e || e->expr_type != EXPR_CONSTANT) + if (!e || e->ts.type != BT_CHARACTER || e->expr_type != EXPR_CONSTANT) return SUCCESS; mode = MODE_STRING; @@ -2082,6 +2082,7 @@ match_dt_format (gfc_dt *dt) locus where; gfc_expr *e; gfc_st_label *label; + match m; where = gfc_current_locus; @@ -2094,7 +2095,7 @@ match_dt_format (gfc_dt *dt) return MATCH_YES; } - if (gfc_match_st_label (&label) == MATCH_YES) + if ((m = gfc_match_st_label (&label)) == MATCH_YES) { if (dt->format_expr != NULL || dt->format_label != NULL) { @@ -2108,6 +2109,9 @@ match_dt_format (gfc_dt *dt) dt->format_label = label; return MATCH_YES; } + else if (m == MATCH_ERROR) + /* The label was zero or too large. Emit the correct diagnosis. */ + return MATCH_ERROR; if (gfc_match_expr (&e) == MATCH_YES) { |