2008-05-30 Vladimir Makarov <vmakarov@redhat.com>
[official-gcc.git] / gcc / testsuite / gfortran.dg / external_procedures_1.f90
blob6e833be16e2eb2ed86af42ff5c8f86b73371602e
1 ! { dg-do compile }
2 ! This tests the patch for PR25024.
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
14 function ext1 (y)
15 real ext1, y
16 external z ! OK no conflict
17 ext1 = y * y
18 end function ext1
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 "Duplicate EXTERNAL attribute" }
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