Bug 41152 - [4.5 Regression] Spurious diagnostic "Extraneous characters in format"
Summary: [4.5 Regression] Spurious diagnostic "Extraneous characters in format"
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.5.0
: P3 normal
Target Milestone: 4.5.0
Assignee: Bud Davis
URL:
Keywords: diagnostic
Depends on:
Blocks:
 
Reported: 2009-08-24 08:52 UTC by Tobias Burnus
Modified: 2009-08-27 12:06 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2009-08-25 02:04:57


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tobias Burnus 2009-08-24 08:52:39 UTC
gfortran now warns for trailing characters in format statements. However, it does not properly work as the following test case (extracted from FLEUR, www.flapw.de) shows:

 7182 FORMAT (a3)
                      1
Warning: Extraneous characters in format at (1)

Due to committal:

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=151021
Log:
2009-08-22      Bud Davis <bdavis9659@sbcglobal.net>

        PR fortran/28093
        * io.c : added variable to store original len of fmt
        * io.c (check_format): Consume H items using next_char
        in both modes to handle consecutive single quotes.
        Test for extra characters in fmt, issue warning.

Test case:
      SUBROUTINE rw_inp()
      CHARACTER(len=100) :: line

      READ(*,FMT="(4x,a)") line
 7182 FORMAT (a3)
 7130 FORMAT (i3)
      END SUBROUTINE rw_inp
Comment 1 Tobias Burnus 2009-08-24 09:02:22 UTC
Also the following fixed-format format looks OK to me:

        WRITE (6,'(//'' icorr is not correctly transferred. icorr='',i5)
     &    ') 42
        END

But it produces:

        WRITE (6,'(//'' icorr is not correctly transferred. icorr='',i5)
                                                                      1
Warning: Extraneous characters in format at (1)
Comment 2 janus 2009-08-24 11:19:15 UTC
Another test case:

character(100), parameter :: subchapter='(79("-"),/,5("-")," ",A,/,79("-"),/)'
write(*,subchapter) 'test'
end


Here the error message is:

write(*,subchapter) 'test'
                                             1
Warning: Extraneous characters in format at (1)

Note that the error shows the line with the write statement, not the line containing the format string.
Comment 3 janus 2009-08-24 11:24:36 UTC
(In reply to comment #0)
> Due to committal:
> 
> URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=151021

For me r151028 seems to work, but r151039 shows the error.
Comment 4 Tobias Burnus 2009-08-27 12:04:05 UTC
The patch of PR 28093 was reverted -- thus closing as fixed.
Comment 5 Tobias Burnus 2009-08-27 12:06:20 UTC
(In reply to comment #4)
> The patch of PR 28093 was reverted -- thus closing as fixed.

Wrong patch PR. The correct one is PR fortran/28039