OSDN Git Service

PR c++/9335
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gfortran.dg / external_procedures_1.f90
1 ! { dg-do compile }
2 ! { dg-options "-std=f95" }
3 !
4 ! This tests the patch for PR25024.
5
6 ! PR25024 - The external attribute for subroutine a would cause an ICE.
7   subroutine A ()
8     EXTERNAL A  ! { dg-error "EXTERNAL attribute conflicts with SUBROUTINE" }
9   END
10
11 function ext (y)  ! { dg-error "EXTERNAL attribute conflicts with FUNCTION" }
12   real ext, y
13   external ext
14   !ext = y * y
15 end function ext
16
17 function ext1 (y)
18   real ext1, y
19   external z        ! OK no conflict
20   ext1 = y * y
21 end function ext1
22
23 program main
24   real ext, inval
25   external ext       ! OK, valid external reference.
26   external main      ! { dg-error "PROGRAM attribute conflicts with EXTERNAL" }
27   interface
28     function ext1 (y)
29       real ext1, y
30       external ext1
31     end function ext1  ! { dg-error "Duplicate EXTERNAL attribute" }
32   end interface
33   inval = 1.0
34   print *, ext(inval)
35   print *, ext1(inval)
36   print *, inv(inval)
37 contains
38   function inv (y)  ! { dg-error "EXTERNAL attribute conflicts with FUNCTION" }
39     real inv, y
40     external inv
41     !inv = y * y * y
42   end function inv
43 end program main
44