https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83282

            Bug ID: 83282
           Summary: missing comma in format changes output
           Product: gcc
           Version: 6.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: urbanjost at comcast dot net
  Target Milestone: ---

I (accidently) used a GNU/gfortran extension, leaving a comma out
  of a format. The output changed unexpectedly.  The description of
  the extension seems to indicate that the behavior should be the same
  whether the comma is present or not. The code produces the following
  output 

    [a    ][bb   ][ccc  ][dddd ]
    [a   [bb  [ccc [dddd 
    [a   [bb  [ccc [dddd 

  The only difference between the three formats is that the first one
  has commas between the edit descriptors, some of which are removed in
  the other two formats ...

program missing_comma
implicit none

! A missing comma in a format changes output
character(len=*),parameter :: array(*)=[character(len=5) ::
'a','bb','ccc','dddd']
   write(*,'(*("[",a,"]":))')array  ! with commas
   ! next, using GNU extension to leave out commas in format
   write(*,'(*("[",a"]":))')array 
   write(*,'(*("["a"]":))')array 

end program missing_comma

This is personally a low-priority issue, but might cause significant problems
for pre-f90 code where the lack of commas in format descriptors is common.

Reply via email to