Commit c9f4aa97 by Jerry DeLisle

re PR fortran/27634 (formatted reading/writing: real format without dot)

2006-05-29  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR fortran/27634
	* io.c (check_format): Add error for missing period in format
	specifier unless -std=legacy.
	* gfortran.texi: Add description of expanded namelist read and
	missing period in format extensions.

From-SVN: r114213
parent a7a8dddd
2006-05-29 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/27634
* io.c (check_format): Add error for missing period in format
specifier unless -std=legacy.
* gfortran.texi: Add description of expanded namelist read and
missing period in format extensions.
2006-05-29 Francois-Xavier Coudert <coudert@clipper.ens.fr> 2006-05-29 Francois-Xavier Coudert <coudert@clipper.ens.fr>
PR fortran/19777 PR fortran/19777
......
...@@ -607,7 +607,7 @@ this is also missing, the default is @file{/tmp}. ...@@ -607,7 +607,7 @@ this is also missing, the default is @file{/tmp}.
@node GFORTRAN_UNBUFFERED_ALL @node GFORTRAN_UNBUFFERED_ALL
@section @env{GFORTRAN_UNBUFFERED_ALL}---Don't buffer output @section @env{GFORTRAN_UNBUFFERED_ALL}---Don't buffer output
This environment variable controls wether all output is unbuffered. This environment variable controls whether all output is unbuffered.
If the first letter is @samp{y}, @samp{Y} or @samp{1}, all output is If the first letter is @samp{y}, @samp{Y} or @samp{1}, all output is
unbuffered. This will slow down large writes. If the first letter is unbuffered. This will slow down large writes. If the first letter is
@samp{n}, @samp{N} or @samp{0}, output is buffered. This is the @samp{n}, @samp{N} or @samp{0}, output is buffered. This is the
...@@ -743,6 +743,7 @@ of extensions, and @option{-std=legacy} allows both without warning. ...@@ -743,6 +743,7 @@ of extensions, and @option{-std=legacy} allows both without warning.
* Extensions to namelist:: * Extensions to namelist::
* X format descriptor:: * X format descriptor::
* Commas in FORMAT specifications:: * Commas in FORMAT specifications::
* Missing period in FORMAT specifications::
* I/O item lists:: * I/O item lists::
* Hexadecimal constants:: * Hexadecimal constants::
* Real array indices:: * Real array indices::
...@@ -857,6 +858,15 @@ PROGRAM test_print ...@@ -857,6 +858,15 @@ PROGRAM test_print
END PROGRAM test_print END PROGRAM test_print
@end smallexample @end smallexample
Expanded namelist reads are permitted. This causes an error if -std=f95
is used. In the following example, the first element of the array will be
given the value 0.00 and succeeding elements will be 1.00 and 2.00.
@smallexample
&MYNML
X(1,1) = 0.00 , 1.00 , 2.00
/
@end smallexample
@node X format descriptor @node X format descriptor
@section X format descriptor @section X format descriptor
@cindex X format descriptor @cindex X format descriptor
...@@ -883,6 +893,21 @@ descriptors in FORMAT statements. ...@@ -883,6 +893,21 @@ descriptors in FORMAT statements.
10 FORMAT ('FOO='I1' BAR='I2) 10 FORMAT ('FOO='I1' BAR='I2)
@end smallexample @end smallexample
@node Missing period in FORMAT specifications
@section Missing period in FORMAT specifications
@cindex Missing period in FORMAT specifications
To support legacy codes, @command{gfortran} allows missing periods in format
specifications if and only if -std=legacy is given on the command line. This
is considered non-conforming code and is discouraged.
@smallexample
REAL :: value
READ(*,10) value
10 FORMAT ('F4')
@end smallexample
@node I/O item lists @node I/O item lists
@section I/O item lists @section I/O item lists
@cindex I/O item lists @cindex I/O item lists
......
...@@ -413,7 +413,6 @@ static try ...@@ -413,7 +413,6 @@ static try
check_format (void) check_format (void)
{ {
const char *posint_required = _("Positive width required"); const char *posint_required = _("Positive width required");
const char *period_required = _("Period required");
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");
...@@ -610,8 +609,13 @@ data_desc: ...@@ -610,8 +609,13 @@ data_desc:
u = format_lex (); u = format_lex ();
if (u != FMT_PERIOD) if (u != FMT_PERIOD)
{ {
error = period_required; /* Warn if -std=legacy, otherwise error. */
goto syntax; if (gfc_option.warn_std != 0)
gfc_error_now ("Period required in format specifier at %C");
else
gfc_warning ("Period required in format specifier at %C");
saved_token = u;
break;
} }
u = format_lex (); u = format_lex ();
...@@ -653,8 +657,13 @@ data_desc: ...@@ -653,8 +657,13 @@ data_desc:
t = format_lex (); t = format_lex ();
if (t != FMT_PERIOD) if (t != FMT_PERIOD)
{ {
error = period_required; /* Warn if -std=legacy, otherwise error. */
goto syntax; if (gfc_option.warn_std != 0)
gfc_error_now ("Period required in format specifier at %C");
else
gfc_warning ("Period required in format specifier at %C");
saved_token = t;
break;
} }
t = format_lex (); t = format_lex ();
......
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