diff options
author | tobi <tobi@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-09-24 21:15:00 +0000 |
---|---|---|
committer | tobi <tobi@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-09-24 21:15:00 +0000 |
commit | bb6696c4b199145879b40b9fd18b0a80dfd750d1 (patch) | |
tree | 6fd80c148ea321cfd2bc3f25ffe2aa5985e2ff64 /gcc/fortran/io.c | |
parent | 6030acb82ee7967a212d4965db7ca8dcb2d5848e (diff) | |
download | gcc-bb6696c4b199145879b40b9fd18b0a80dfd750d1.tar.gz |
PR fortran/33269
fortran/
* io.c (check_format_string): Move NULL and constant checks into
this function.
(check_io_constraints): Call gfc_simplify_expr() before calling
check_format_string(). Remove NULL and constant checks.
testsuite/
* gfortran.dg/fmt_error_2.f90: New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@128732 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran/io.c')
-rw-r--r-- | gcc/fortran/io.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/gcc/fortran/io.c b/gcc/fortran/io.c index 901af922b95..0e2a0cb7df2 100644 --- a/gcc/fortran/io.c +++ b/gcc/fortran/io.c @@ -919,6 +919,9 @@ finished: static try check_format_string (gfc_expr *e, bool is_input) { + if (!e || e->expr_type != EXPR_CONSTANT) + return SUCCESS; + mode = MODE_STRING; format_string = e->value.character.string; return check_format (is_input); @@ -2786,8 +2789,8 @@ if (condition) \ } expr = dt->format_expr; - if (expr != NULL && expr->expr_type == EXPR_CONSTANT - && check_format_string (expr, k == M_READ) == FAILURE) + if (gfc_simplify_expr (expr, 0) == FAILURE + || check_format_string (expr, k == M_READ) == FAILURE) return MATCH_ERROR; return m; |