break;
case FMT_H:
- if (!(gfc_option.allow_std & GFC_STD_GNU) && !inhibit_warnings)
+ if (!(gfc_option.allow_std & GFC_STD_LEGACY))
{
- if (mode != MODE_FORMAT)
- format_locus.nextc += format_string_pos;
- gfc_warning (0, "The H format specifier at %L is"
- " a Fortran 95 deleted feature", &format_locus);
+ error = G_("The H format specifier at %L is a Fortran 95 deleted"
+ " feature");
+ goto syntax;
}
+ if (mode != MODE_FORMAT)
+ format_locus.nextc += format_string_pos;
+ gfc_warning (0, "The H format specifier at %L is"
+ " a Fortran 95 deleted feature", &format_locus);
if (mode == MODE_STRING)
{
format_string += value;
}
else
{
- while (repeat >0)
+ while (repeat > 0)
{
next_char (INSTRING_WARN);
repeat -- ;
subroutine foo1 (slist, i)
character(*), dimension(*) :: slist
integer i
- write (slist(i), '(2hi=,i3)') i
+ write (slist(i), '(2hi=,i3)') i ! { dg-warning "H format specifier" }
end subroutine foo1
subroutine foo2 (slist, i)
character(5), dimension(:) :: slist
integer i
- write (slist(i), '(2hi=,i3)') i
+ write (slist(i), '(2hi=,i3)') i ! { dg-warning "H format specifier" }
end subroutine foo2
subroutine foo3 (slist, i)
character(5), dimension(:,:) :: slist
integer i
- write (slist(1,1), '(2hi=,i3)') i
+ write (slist(1,1), '(2hi=,i3)') i ! { dg-warning "H format specifier" }
end subroutine foo3
end program test_lex
f2 = eoshift(e,shift=n,boundary=bnd2) ! { dg-error "has invalid shape" }
f2 = eoshift(e,shift=1,boundary="x") ! { dg-error "must be of same type and kind" }
- print '(*(1H",A,1H",:","))',f2
+ !print '(*(1H",A,1H",:","))',f2
end program main
C
C { dg-do run }
C { dg-output "^" }
- 10 format(1H1)
- 20 format(6H 6)
+C { dg-options "-std=legacy"
+ 10 format(1H1) ! { dg-warning "H format specifier" }
+ 20 format(6H 6) ! { dg-warning "H format specifier" }
write(*,10) ! { dg-output "1(\r*\n+)" }
write(*,20) ! { dg-output " 6(\r*\n+)" }
- write(*,'(16H''apostrophe'' fun)') ! { dg-output "'apostrophe' fun(\r*\n+)" }
+ write(*,'(16H''apostrophe'' fun)') ! { dg-warning "H format specifier" }
+ ! { dg-output "'apostrophe' fun(\r*\n+)" }
C { dg-output "\$" }
end
! Also verifies the functioning of hollerith formatting.
character*72 c
write(c,8000)
-8000 format(36(2H!)))
+8000 format(36(2H!))) ! { dg-warning "H format specifier" }
do i = 1,72,2
if (c(i:i+1) /= '!)') STOP 1
end do
! { dg-do compile }
-! { dg-options "-std=f95" }
+! { dg-options "-std=legacy" }
! Part I of the test of the IO constraints patch, which fixes PRs:
! PRs 25053, 25063, 25064, 25066, 25067, 25068, 25069, 25307 and 20862.
!
!
module fails
- 2000 format (1h , 2i6) ! { dg-error "Format statement in module" }
+ 2000 format (2i6) ! { dg-error "Format statement in module" }
end module fails
subroutine foo (i)
integer :: i
write (*, 100) i
- 100 format (1h , "i=", i6) ! { dg-warning "The H format specifier at ... is a Fortran 95 deleted feature" }
+ 100 format ("i=", i6)
end subroutine foo
end module global
! Appending to a USE associated namelist is an extension.
- NAMELIST /NL/ a,b ! { dg-error "already is USE associated" }
+ NAMELIST /NL/ a,b
a=1 ; b=2
! R912
!Was correctly picked up before patch.
- write(6, NML=NL, iostat = ierr) ! { dg-error "requires default INTEGER" }
+ write(6, NML=NL, iostat = ierr)
! Constraints
!Was correctly picked up before patch.
subroutine foo (i)
integer :: i
write (*, 100) i
- 100 format (1h , "i=", i6) ! { dg-warning "H format specifier" }
+ 100 format ("i=", i6)
end subroutine foo
end module global
character*10 cpnam
character*4 csig
write (34,808) csig,ilax,cpnam
- 808 format (/9X,4HTHE ,A4, 29HTIVE MINOS ERROR OF PARAMETER,I3, 2H
- +, ,A10)
+ 808 format (/9X,'THE ',A4, 'TIVE MINOS ERROR OF PARAMETER',I3, '
+ +,' ,A10)
end
if (line.ne.' stiffness reformed for hello hello')STOP 2
stop
- 2070 format (2x,37hstiffness reformed for this high step)
- 2090 format (2x,34hstiffness reformed for hello hello)
+ 2070 format (2x,37hstiffness reformed for this high step) ! { dg-warning "H format specifier" }
+ 2090 format (2x,34hstiffness reformed for hello hello) ! { dg-warning "H format specifier" }
end
subroutine foo1 (slist, i)
character(*), dimension(*) :: slist
integer i
- write (slist(i), '(2hi=,i3)') i
+ write (slist(i), '(2hi=,i3)') i ! { dg-warning "H format specifier" }
end subroutine foo1
! This tests the additions to the fix that prevent the dummies of entry thunks
c Line 3 has x editing finished off by a 1h*
write (10, 100)
- 100 format (1h1,58x,1h!,/,60x,/,59x,1h*,/)
+ 100 format (1h1,58x,1h!,/,60x,/,59x,1h*,/) ! { dg-warning "H format specifier" }
rewind (10)
read (10, 200) a
write (10, 101)
101 format (1h1,58x,1h#,/,t38,2x,1h ,tr10,9x,1h$,/,
- > 6habcdef,tl4,2x,6hghijkl,t1,59x,1h*)
+ > 6habcdef,tl4,2x,6hghijkl,t1,59x,1h*) ! { dg-warning "H format specifier" }
rewind (10)
read (10, 200) a