Bug 89103 - Allow blank format items in format strings
Summary: Allow blank format items in format strings
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 9.0
: P4 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: deferred
Depends on:
Blocks:
 
Reported: 2019-01-29 14:46 UTC by MarkEggleston
Modified: 2019-06-19 03:02 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2019-01-29 00:00:00


Attachments
Patch to allow blank item in format (1.41 KB, application/mbox)
2019-01-29 14:46 UTC, MarkEggleston
Details
Change log for gcc/fortran for patch (224 bytes, text/plain)
2019-01-29 14:47 UTC, MarkEggleston
Details
Change Log for gc/testsuite for patch (150 bytes, text/plain)
2019-01-29 14:47 UTC, MarkEggleston
Details
Updated change log for gcc/fortran for patch (215 bytes, text/plain)
2019-02-05 10:18 UTC, MarkEggleston
Details
Patch to allow blank item in format (2.29 KB, patch)
2019-02-14 09:43 UTC, MarkEggleston
Details | Diff
Change log for gcc/fortran for patch (274 bytes, text/plain)
2019-02-14 09:45 UTC, MarkEggleston
Details
Change Log for gcc/testsuite for patch (149 bytes, text/plain)
2019-02-14 09:47 UTC, MarkEggleston
Details

Note You need to log in before you can comment on or make changes to this bug.
Description MarkEggleston 2019-01-29 14:46:12 UTC
Created attachment 45554 [details]
Patch to allow blank item in format

gfortran as of revision: svn+ssh://gcc.gnu.org/svn/gcc/trunk@268360

At the end of list of specifiers a blank item can appear between the comma and closing bracket.

The following error is produced, as it should be:

   18 | 10        FORMAT( I5,)
      |                      1
Error: Unexpected element ')' in format string at (1)

In legacy Fortran this is not the case PGI Fortran 18.10 silently accepts this with no compiler switches. I believe this is feature originated from DEC Fortran.

Attached is a patch that will allow this.

As this is non-standard Fortran this feature is only enabled using -fdec-blank-format-item which is also enabled by -fdec.
Comment 1 MarkEggleston 2019-01-29 14:47:12 UTC
Created attachment 45555 [details]
Change log for gcc/fortran for patch
Comment 2 MarkEggleston 2019-01-29 14:47:45 UTC
Created attachment 45556 [details]
Change Log for gc/testsuite for patch
Comment 3 kargl 2019-01-29 17:30:13 UTC
The patch was discussed in the fortran@ list.  One can
find history here: https://gcc.gnu.org/ml/fortran/2019-01/msg00175.html
Comment 4 kargl 2019-01-29 20:28:49 UTC
Forgot to note that the patch is ok to commit when gcc 10 stage 1 opens.
Comment 5 Jakub Jelinek 2019-02-04 16:25:30 UTC
ChangeLog formatting nit - two spaces before < from email address (and two spaces between date and name.
Comment 6 MarkEggleston 2019-02-05 10:18:52 UTC
Created attachment 45604 [details]
Updated change log for gcc/fortran for patch
Comment 7 MarkEggleston 2019-02-14 09:43:25 UTC
Created attachment 45711 [details]
Patch to allow blank item in format

Add documentation changes.
Comment 8 MarkEggleston 2019-02-14 09:45:48 UTC
Created attachment 45712 [details]
Change log for gcc/fortran for patch

Add changes to documentation.
Comment 9 MarkEggleston 2019-02-14 09:47:17 UTC
Created attachment 45713 [details]
Change Log for gcc/testsuite for patch

Replace -fdec-blank-format-item with PR fortran/89103.
Comment 10 Jerry DeLisle 2019-06-19 03:02:52 UTC
Author: jvdelisle
Date: Wed Jun 19 03:02:21 2019
New Revision: 272467

URL: https://gcc.gnu.org/viewcvs?rev=272467&root=gcc&view=rev
Log:
2019-06-19  Jim MacArthur  <jim.macarthur@codethink.co.uk>
	    Mark Eggleston  <mark.eggleston@codethink.com>

	PR fortran/89103
	* gfortran.texi: Add -fdec-blank-format-item
	* invoke.texi: Add option to list of options.
	* invoke.texi: Add to section on Commas in FORMAT specifications.
	* io.c (check_format): At FMT_RPAREN goto finished if
	-fdec-blank-format-item otherwise set error string.
	* lang.opt: Add new option.
	* options.c (set_dec_flags): Add SET_BITFLAG for
	flag_dec_format_defaults.

	* gfortran.dg/dec_format_empty_item_1.f: New test.
	* gfortran.dg/dec_format_empty_item_2.f: New test.
	* gfortran.dg/dec_format_empty_item_3.f: New test.

Added:
    trunk/gcc/testsuite/gfortran.dg/dec_format_empty_item_1.f
    trunk/gcc/testsuite/gfortran.dg/dec_format_empty_item_2.f
    trunk/gcc/testsuite/gfortran.dg/dec_format_empty_item_3.f
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/gfortran.texi
    trunk/gcc/fortran/invoke.texi
    trunk/gcc/fortran/io.c
    trunk/gcc/fortran/lang.opt
    trunk/gcc/fortran/options.c
    trunk/gcc/testsuite/ChangeLog