Debian Codegraph @

gcc/testsuite/gfortran.dg/deferred_character_18.f90

raw
1 ! { dg-do compile }
2 ! PR Fortran/82367
3 ! Contributed by Walter Spector <w6ws at earthlink dot net>
4 module cls_allocmod
5 implicit none
6
7 contains
8
9 subroutine cls_alloc (n, str)
10 integer, intent(in) :: n
11 character(*), allocatable, intent(out) :: str
12 ! Note: Star ^ should have been a colon (:)
13
14 ! allocate (character(n)::str) ! original invalid version from pr82367
15 allocate (character(*)::str) ! corrected (see F2003:C626 and pr119338)
16
17 end subroutine
18
19 end module
20
21 program cls
22 use cls_allocmod
23 implicit none
24
25 character(:), allocatable :: s
26
27 call cls_alloc(42, s) ! { dg-error "allocatable or pointer dummy argument" }
28 print *, 'string len =', len(s)
29
30 end program