Commit 8955a005 by Jerry DeLisle

PR fortran/36420, 36422

2008-06-07  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR fortran/36420, 36422
	* io.c (check_format): Add new error message for zero width. Use new
	error message for FMT_A and with READ, FMT_G.  Allow FMT_G with WRITE
	except when -std=F95 and -std=F2003.

From-SVN: r136544
parent 359ce95f
2008-06-07 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/36420, 36422
* io.c (check_format): Add new error message for zero width.
Use new error message for FMT_A and with READ, FMT_G. Allow
FMT_G with WRITE except when -std=F95 and -std=F2003.
2008-06-07 Tobias Burnus <burnus@net-b.de> 2008-06-07 Tobias Burnus <burnus@net-b.de>
PR fortran/36437 PR fortran/36437
......
...@@ -476,6 +476,7 @@ check_format (bool is_input) ...@@ -476,6 +476,7 @@ check_format (bool is_input)
const char *nonneg_required = _("Nonnegative width required"); const char *nonneg_required = _("Nonnegative width required");
const char *unexpected_element = _("Unexpected element"); const char *unexpected_element = _("Unexpected element");
const char *unexpected_end = _("Unexpected end of format string"); const char *unexpected_end = _("Unexpected end of format string");
const char *zero_width = _("Zero width in format descriptor");
const char *error; const char *error;
format_token t, u; format_token t, u;
...@@ -672,6 +673,11 @@ data_desc: ...@@ -672,6 +673,11 @@ data_desc:
t = format_lex (); t = format_lex ();
if (t == FMT_ERROR) if (t == FMT_ERROR)
goto fail; goto fail;
if (t == FMT_ZERO)
{
error = zero_width;
goto syntax;
}
if (t != FMT_POSINT) if (t != FMT_POSINT)
saved_token = t; saved_token = t;
break; break;
...@@ -681,6 +687,18 @@ data_desc: ...@@ -681,6 +687,18 @@ data_desc:
case FMT_G: case FMT_G:
case FMT_EXT: case FMT_EXT:
u = format_lex (); u = format_lex ();
if (t == FMT_G && u == FMT_ZERO)
{
if (is_input)
{
error = zero_width;
goto syntax;
}
else
return gfc_notify_std (GFC_STD_F2008, "Fortran F2008: 'G0' in "
"format at %C");
}
if (u == FMT_ERROR) if (u == FMT_ERROR)
goto fail; goto fail;
if (u != FMT_POSINT) if (u != FMT_POSINT)
...@@ -1711,7 +1729,7 @@ gfc_match_open (void) ...@@ -1711,7 +1729,7 @@ gfc_match_open (void)
if (open->round) if (open->round)
{ {
/* When implemented, change the following to use gfc_notify_std F2003. */ /* When implemented, change the following to use gfc_notify_std F2003. */
gfc_error ("F2003 Feature: ROUND= specifier at %C not implemented"); gfc_error ("Fortran F2003: ROUND= specifier at %C not implemented");
goto cleanup; goto cleanup;
if (open->round->expr_type == EXPR_CONSTANT) if (open->round->expr_type == EXPR_CONSTANT)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment