diff options
author | jvdelisle <jvdelisle@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-12-21 21:20:29 +0000 |
---|---|---|
committer | jvdelisle <jvdelisle@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-12-21 21:20:29 +0000 |
commit | 7133c3fde2b5fabad1d09481e852154a496543ae (patch) | |
tree | 26160a925575637d59156978296bc6c30ac98399 /gcc/fortran | |
parent | e5e3ed0ffcee5e79eea3af9b250e40fca7d26463 (diff) | |
download | gcc-7133c3fde2b5fabad1d09481e852154a496543ae.tar.gz |
2008-12-21 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/38398
* io.c: Add error checks for g0 formatting and provide adjustment of
error loci for improved error messages.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@142870 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran')
-rw-r--r-- | gcc/fortran/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/fortran/io.c | 16 |
2 files changed, 19 insertions, 3 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index eaa496da868..b3e3034857b 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2008-12-21 Jerry DeLisle <jvdelisle@gcc.gnu.org> + + PR fortran/38398 + * io.c: Add error checks for g0 formatting and provide adjustment of + error loci for improved error messages. + 2008-12-21 Arjen Markus <arjen.markus@wldelft.nl> Daniel Kraft <d@domob.eu> diff --git a/gcc/fortran/io.c b/gcc/fortran/io.c index 98112fcb8a8..57e65f85422 100644 --- a/gcc/fortran/io.c +++ b/gcc/fortran/io.c @@ -118,6 +118,7 @@ format_token; used to back up by a single format token during the parsing process. */ static gfc_char_t *format_string; +static int format_string_pos; static int format_length, use_last_char; static char error_element; static locus format_locus; @@ -170,6 +171,8 @@ next_char (int in_string) if (mode != MODE_STRING) format_locus = gfc_current_locus; + format_string_pos++; + c = gfc_wide_toupper (c); return c; } @@ -503,6 +506,7 @@ check_format (bool is_input) level = 0; repeat = 0; rv = SUCCESS; + format_string_pos = 0; t = format_lex (); if (t == FMT_ERROR) @@ -729,15 +733,19 @@ data_desc: saved_token = u; break; } - u = format_lex (); - if (u == FMT_ERROR) - goto fail; if (u != FMT_POSINT) { error = posint_required; goto syntax; } + u = format_lex (); + if (u == FMT_E) + { + error = _("E specifier not allowed with g0 descriptor"); + goto syntax; + } + saved_token = u; break; } @@ -983,6 +991,8 @@ extension_optional_comma: goto format_item; syntax: + if (mode != MODE_FORMAT) + format_locus.nextc += format_string_pos; if (error == unexpected_element) gfc_error (error, error_element, &format_locus); else |