2010-11-30 Tobias Burnus <burnus@net-b.de>
[official-gcc.git] / gcc / testsuite / gfortran.dg / auto_char_len_4.f90
blob6b4e26e6b453f8168d702b533be1a3064d936719
1 ! { dg-do compile }
2 ! { dg-options "-fwhole-file" }
4 ! Tests the fix for PR25087, in which the following invalid code
5 ! was not detected.
7 ! Contributed by Joost VandeVondele <jv244@cam.ac.uk>
9 ! Modified by Tobias Burnus to fix PR fortran/41235.
11 FUNCTION a()
12 CHARACTER(len=10) :: a
13 a = ''
14 END FUNCTION a
16 SUBROUTINE s(n)
17 CHARACTER(LEN=n), EXTERNAL :: a ! { dg-error "must have an explicit interface" }
18 CHARACTER(LEN=n), EXTERNAL :: d ! { dg-error "must have an explicit interface" }
19 interface
20 function b (m) ! This is OK
21 CHARACTER(LEN=m) :: b
22 integer :: m
23 end function b
24 end interface
25 write(6,*) a()
26 write(6,*) b(n)
27 write(6,*) c()
28 write(6,*) d()
29 contains
30 function c () ! This is OK
31 CHARACTER(LEN=n):: c
32 c = ""
33 end function c
34 END SUBROUTINE s
36 FUNCTION d()
37 CHARACTER(len=99) :: d
38 d = ''
39 END FUNCTION d