From db697236acc86157bcca24d4a9c78d59b5c161d8 Mon Sep 17 00:00:00 2001 From: jvdelisle Date: Wed, 4 Jul 2007 01:08:48 +0000 Subject: [PATCH] 2007-07-03 Jerry DeLisle PR fortran/32545 * io.c (check_format): Always call gfc_error for errors. (check_format_string): Change type of this function to try and return the result of check_format. (check_io_constraints): Return MATCH_ERROR if check_format_string returns FAILURE. 2007-07-03 Jerry DeLisle PR fortran/32612 * decl.c (get_proc_name): Include attr->mod_proc in check for error. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@126295 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/ChangeLog | 14 ++++++++++++++ gcc/fortran/decl.c | 3 ++- gcc/fortran/io.c | 25 ++++++++----------------- 3 files changed, 24 insertions(+), 18 deletions(-) diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 2fe400c..c128097 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,5 +1,19 @@ 2007-07-03 Jerry DeLisle + PR fortran/32545 + * io.c (check_format): Always call gfc_error for errors. + (check_format_string): Change type of this function to try and + return the result of check_format. + (check_io_constraints): Return MATCH_ERROR if check_format_string + returns FAILURE. + +2007-07-03 Jerry DeLisle + + PR fortran/32612 + * decl.c (get_proc_name): Include attr->mod_proc in check for error. + +2007-07-03 Jerry DeLisle + PR fortran/32432 * gfortran.h: Change type of gfc_assign_data_value from void to try. * data.c (gfc_assign_data_value): Return FAILURE if error found. diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index 24f1a3d..b3bbe75 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -708,7 +708,8 @@ get_proc_name (const char *name, gfc_symbol **result, bool module_fcn_entry) /* Trap a procedure with a name the same as interface in the encompassing scope. */ if (sym->attr.generic != 0 - && (sym->attr.subroutine || sym->attr.function)) + && (sym->attr.subroutine || sym->attr.function) + && !sym->attr.mod_proc) gfc_error_now ("Name '%s' at %C is already defined" " as a generic interface at %L", name, &sym->declared_at); diff --git a/gcc/fortran/io.c b/gcc/fortran/io.c index e8f4deb..7f5e575 100644 --- a/gcc/fortran/io.c +++ b/gcc/fortran/io.c @@ -842,20 +842,10 @@ extension_optional_comma: goto format_item; syntax: - /* Something went wrong. If the format we're checking is a string, - generate a warning, since the program is correct. If the format - is in a FORMAT statement, this messes up parsing, which is an - error. */ - if (mode != MODE_STRING) - gfc_error ("%s in format string at %C", error); - else - { - gfc_warning ("%s in format string at %C", error); - - /* TODO: More elaborate measures are needed to show where a problem - is within a format string that has been calculated. */ - } + gfc_error ("%s in format string at %C", error); + /* TODO: More elaborate measures are needed to show where a problem + is within a format string that has been calculated. */ rv = FAILURE; finished: @@ -866,12 +856,12 @@ finished: /* Given an expression node that is a constant string, see if it looks like a format string. */ -static void +static try check_format_string (gfc_expr *e, bool is_input) { mode = MODE_STRING; format_string = e->value.character.string; - check_format (is_input); + return check_format (is_input); } @@ -2752,8 +2742,9 @@ if (condition) \ } expr = dt->format_expr; - if (expr != NULL && expr->expr_type == EXPR_CONSTANT) - check_format_string (expr, k == M_READ); + if (expr != NULL && expr->expr_type == EXPR_CONSTANT + && check_format_string (expr, k == M_READ) == FAILURE) + return MATCH_ERROR; return m; } -- 2.7.4