OSDN Git Service

2010-06-18 Jerry DeLisle <jvdelisle@gcc.gnu.org>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gfortran.dg / auto_char_len_4.f90
1 ! { dg-do compile }
2 ! { dg-options "-fwhole-file" }
3 !
4 ! Tests the fix for PR25087, in which the following invalid code
5 ! was not detected.
6 !
7 ! Contributed by Joost VandeVondele  <jv244@cam.ac.uk>
8 !
9 ! Modified by Tobias Burnus to fix PR fortran/41235.
10 !
11 FUNCTION a()
12   CHARACTER(len=10) :: a
13   a = ''
14 END FUNCTION a
15
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
35
36 FUNCTION d()
37   CHARACTER(len=99) :: d
38   d = ''
39 END FUNCTION d