| 1 |
! { dg-do compile } |
| 2 |
! test case contributed by [email protected] |
| 3 |
! PR28039 Warn when ignoring extra characters in the format specification |
| 4 |
implicit none |
| 5 |
real :: r |
| 6 |
r = 1.0 |
| 7 |
write(*,'(a),f)') 'Hello', r ! { dg-warning "Extraneous characters in format at" } |
| 8 |
end |
| 9 |
! Below routine was also submitted by [email protected] |
| 10 |
! It showed up some problems with the initial implementation of this |
| 11 |
! feature. |
| 12 |
! This routine should compile without complaint or warning. |
| 13 |
SUBROUTINE rw_inp() |
| 14 |
CHARACTER(len=100) :: line |
| 15 |
integer :: i5 |
| 16 |
character(100), parameter :: subchapter = |
| 17 |
& '(79("-"),/,5("-")," ",A,/,79("-"),/)' |
| 18 |
i5 = 1 |
| 19 |
|
| 20 |
READ(*,FMT="(4x,a)") line |
| 21 |
7182 FORMAT (a3) |
| 22 |
7130 FORMAT (i3) |
| 23 |
|
| 24 |
WRITE (6,'(//'' icorr is not correctly transferred. icorr='',i5) |
| 25 |
& ') 42 |
| 26 |
|
| 27 |
write(*,subchapter) 'test' |
| 28 |
END SUBROUTINE rw_inp |