[Bug fortran/84389] Defined output: unexpected compiler error with the use of ":" edit descriptor
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84389 Jerry DeLisle changed: What|Removed |Added Status|ASSIGNED|RESOLVED Resolution|--- |FIXED --- Comment #9 from Jerry DeLisle --- Fixed on gcc 8, no plan to backport.
[Bug fortran/84389] Defined output: unexpected compiler error with the use of ":" edit descriptor
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84389 --- Comment #8 from Jerry DeLisle --- Author: jvdelisle Date: Sun Feb 18 19:19:47 2018 New Revision: 257795 URL: https://gcc.gnu.org/viewcvs?rev=257795=gcc=rev Log: 2018-02-18 Jerry DeLislePR fortran/84389 * io.c (check_format): Allow FMT_COLON. * gfortran.dg/dtio_33.f90: New test. Added: trunk/gcc/testsuite/gfortran.dg/dtio_33.f90 Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/io.c trunk/gcc/testsuite/ChangeLog
[Bug fortran/84389] Defined output: unexpected compiler error with the use of ":" edit descriptor
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84389 Jerry DeLisle changed: What|Removed |Added Status|NEW |ASSIGNED
[Bug fortran/84389] Defined output: unexpected compiler error with the use of ":" edit descriptor
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84389 --- Comment #7 from Steve Kargl --- On Sat, Feb 17, 2018 at 03:56:14AM +, jvdelisle at gcc dot gnu.org wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84389 > > I think I prefer this patch, regression tested OK. > > diff --git a/gcc/fortran/io.c b/gcc/fortran/io.c > index 9b7c2de16f4..d9f0fb1d4ac 100644 > --- a/gcc/fortran/io.c > +++ b/gcc/fortran/io.c > @@ -985,6 +985,9 @@ data_desc: > case FMT_COMMA: > goto format_item; > > + case FMT_COLON: > + goto format_item_1; > + > case FMT_LPAREN: > >dtio_vlist: > Works for me.
[Bug fortran/84389] Defined output: unexpected compiler error with the use of ":" edit descriptor
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84389 Jerry DeLisle changed: What|Removed |Added CC||jvdelisle at gcc dot gnu.org --- Comment #6 from Jerry DeLisle --- (In reply to Steve Kargl from comment #5) > This patch fixes the problem, but I'm in an area of > the compiler that I do not too well. It might open > gfortran to other problems. Jerry, any comments? > > Index: io.c > === > --- io.c (revision 257695) > +++ io.c (working copy) > @@ -1012,8 +1012,7 @@ data_desc: > goto between_desc; > > default: > - error = unexpected_element; > - goto syntax; > + goto format_item_1; > } >break; Hi Steve, I think I prefer this patch, regression tested OK. diff --git a/gcc/fortran/io.c b/gcc/fortran/io.c index 9b7c2de16f4..d9f0fb1d4ac 100644 --- a/gcc/fortran/io.c +++ b/gcc/fortran/io.c @@ -985,6 +985,9 @@ data_desc: case FMT_COMMA: goto format_item; + case FMT_COLON: + goto format_item_1; + case FMT_LPAREN: dtio_vlist:
[Bug fortran/84389] Defined output: unexpected compiler error with the use of ":" edit descriptor
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84389 --- Comment #5 from Steve Kargl --- This patch fixes the problem, but I'm in an area of the compiler that I do not too well. It might open gfortran to other problems. Jerry, any comments? Index: io.c === --- io.c(revision 257695) +++ io.c(working copy) @@ -1012,8 +1012,7 @@ data_desc: goto between_desc; default: - error = unexpected_element; - goto syntax; + goto format_item_1; } break;
[Bug fortran/84389] Defined output: unexpected compiler error with the use of ":" edit descriptor
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84389 kargl at gcc dot gnu.org changed: What|Removed |Added Status|UNCONFIRMED |NEW Last reconfirmed||2018-02-15 Ever confirmed|0 |1 --- Comment #4 from kargl at gcc dot gnu.org --- Confirmed.
[Bug fortran/84389] Defined output: unexpected compiler error with the use of ":" edit descriptor
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84389 --- Comment #3 from Steve Kargl --- On Thu, Feb 15, 2018 at 09:04:24PM +, fortranfan at outlook dot com wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84389 > > --- Comment #2 from Vipul Parekh --- > Thank for your response. > > Per section 1.4.1 in 10-007r1 toward Fortran 2008 on syntax rules toward the > BNF convention in the document, line 16 says [] encloses an optional item. > > R1303 format-items is format-item [ [ , ] format-item ] > > then suggests the comma in the format item is optional and the format in the > first post should work as shown. > Ah, indeed! You are correct. I simply missed the enclosing [ ] in looking through all of the ENBDF rules.
[Bug fortran/84389] Defined output: unexpected compiler error with the use of ":" edit descriptor
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84389 --- Comment #2 from Vipul Parekh --- Thank for your response. Per section 1.4.1 in 10-007r1 toward Fortran 2008 on syntax rules toward the BNF convention in the document, line 16 says [] encloses an optional item. R1303 format-items is format-item [ [ , ] format-item ] then suggests the comma in the format item is optional and the format in the first post should work as shown.
[Bug fortran/84389] Defined output: unexpected compiler error with the use of ":" edit descriptor
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84389 kargl at gcc dot gnu.org changed: What|Removed |Added Priority|P3 |P4 CC||kargl at gcc dot gnu.org --- Comment #1 from kargl at gcc dot gnu.org --- (In reply to Vipul Parekh from comment #0) > Consider the following: > > --- begin console output --- > C:\Temp>type p.f90 > module m > >type :: t > private If you add integer i to work around the issue you reported in different bug report, and ... >contains > private > procedure, pass(this) :: write_t > generic, public :: write(formatted) => write_t >end type > > contains > >subroutine write_t(this, lun, iotype, vlist, istat, imsg) > > ! argument definitions > class(t), intent(in):: this > integer, intent(in) :: lun > character(len=*), intent(in):: iotype > integer, intent(in) :: vlist(:) > integer, intent(out):: istat > character(len=*), intent(inout) :: imsg > > write(lun, fmt=*, iostat=istat, iomsg=imsg) "Hello World!" > > return > >end subroutine write_t > > end module > > program p > >use m, only : t > >type(t) :: foo(2) > >print "(*(dt:,','))", foo provide a valid format-item, then gfortran gives the expected output. gfcx -o z b.f90 && ./z Hello World!, Hello World! The EBNF in F2018 is R1301 format-stmt is FORMAT format-specification R1302 format-specification is ( [ format-items ] ) or ( [ format-items, ] unlimited-format-item ) R1305 unlimited-format-item is * ( format-items ) R1303 format-items is format-item [ [ , ] format-item ] ... R1304 format-item is [ r ] data-edit-desc or control-edit-desc R1307 data-edit-descis I w [ . m ] ... or DT [ char-literal-constant ][ ( v-list ) ] R724 char-literal-constant is [ kind-param _ ] ' [ rep-char ] ... ' or [ kind-param _ ] " [ rep-char ] ... " R1312 v is signed-int-literal-constant R1313 control-edit-desc is position-edit-desc or : You have DT:. The colon is neither a char-literal-constant nor v-list. If you want the colon to be a control-edit-desc, then you need to include a format-item for it. The format string you want is "(*(dt,:','))".