OSDN Git Service

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