aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran
diff options
context:
space:
mode:
authorJerry DeLisle <jvdelisle@gcc.gnu.org>2019-11-07 03:06:20 +0000
committerJerry DeLisle <jvdelisle@gcc.gnu.org>2019-11-07 03:06:20 +0000
commit67732fbced89c42dabea4a3bc160da80d0db046a (patch)
treefeabf2ec8e1c3d38e1b267137d531abd42748a24 /gcc/fortran
parentce6c0a20b5875c18a8416d60950febea76a4b9d3 (diff)
downloadgcc-67732fbced89c42dabea4a3bc160da80d0db046a.zip
gcc-67732fbced89c42dabea4a3bc160da80d0db046a.tar.gz
gcc-67732fbced89c42dabea4a3bc160da80d0db046a.tar.bz2
re PR libfortran/90374 (Fortran 2018: Support d0.d, e0.d, es0.d, en0.d, g0.d and ew.d e0 edit descriptors for output)
2019-11-06 Jerry DeLisle <jvdelisle@gcc.ngu.org> PR fortran/90374 * io.c (check_format): Allow zero width for D, E, EN, and ES specifiers as default and when -std=F2018 is given. Retain existing errors when using the -fdec family of flags. * libgfortran/io/format.c (parse_format_list): Relax format checking for zero width as default and when -std=f2018. io/format.h (format_token): Move definition to io.h. io/io.h (format_token): Add definition here to allow access to this definition at higher levels. Rename the declaration of write_real_g0 to write_real_w0 and add a new format_token argument, allowing higher level functions to pass in the token for handling of g0 vs the other zero width specifiers. io/transfer.c (formatted_transfer_scalar_write): Add checks for zero width and call write_real_w0 to handle it. io/write.c (write_real_g0): Remove. (write_real_w0): Add new, same as previous write_real_g0 except check format token to handle the g0 case. * gfortran.dg/fmt_error_10.f: Modify for new constraints. * gfortran.dg/fmt_error_7.f: Add dg-options "-std=f95". * gfortran.dg/fmt_error_9.f: Modify for new constraints. * gfortran.dg/fmt_zero_width.f90: New test. From-SVN: r277905
Diffstat (limited to 'gcc/fortran')
-rw-r--r--gcc/fortran/ChangeLog7
-rw-r--r--gcc/fortran/io.c33
2 files changed, 33 insertions, 7 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index f9f9da2..5023949 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,10 @@
+2019-11-06 Jerry DeLisle <jvdelisle@gcc.ngu.org>
+
+ PR fortran/90374
+ * io.c (check_format): Allow zero width for D, E, EN, and ES
+ specifiers as default and when -std=F2018 is given. Retain
+ existing errors when using the -fdec family of flags.
+
2019-11-03 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/92113
diff --git a/gcc/fortran/io.c b/gcc/fortran/io.c
index b969a1a..57a3fdd 100644
--- a/gcc/fortran/io.c
+++ b/gcc/fortran/io.c
@@ -922,19 +922,38 @@ data_desc:
if (u != FMT_POSINT)
{
+ if (flag_dec)
+ {
+ if (flag_dec_format_defaults)
+ {
+ /* Assume a default width based on the variable size. */
+ saved_token = u;
+ break;
+ }
+ else
+ {
+ gfc_error ("Positive width required in format "
+ "specifier %s at %L", token_to_string (t),
+ &format_locus);
+ saved_token = u;
+ goto fail;
+ }
+ }
+
+ format_locus.nextc += format_string_pos;
+ if (!gfc_notify_std (GFC_STD_F2018,
+ "positive width required at %L",
+ &format_locus))
+ {
+ saved_token = u;
+ goto fail;
+ }
if (flag_dec_format_defaults)
{
/* Assume a default width based on the variable size. */
saved_token = u;
break;
}
-
- format_locus.nextc += format_string_pos;
- gfc_error ("Positive width required in format "
- "specifier %s at %L", token_to_string (t),
- &format_locus);
- saved_token = u;
- goto fail;
}
u = format_lex ();