2014-07-12 Paul Thomas <pault@gcc.gnu.org>
[official-gcc.git] / gcc / testsuite / gfortran.dg / elemental_subroutine_5.f90
blobefadb6d14390b9196ab98a236e98ebce25e7e8db
1 ! { dg-do compile }
3 ! PR fortran/33231
5 ! Elemental function:
6 ! Intent OUT/INOUT dummy: Actual needs to be an array
7 ! if any actual is an array
9 program prog
10 implicit none
11 integer :: i, j(2)
12 call sub(i,1,2) ! OK, only scalar
13 call sub(j,1,2) ! OK, scalar IN, array OUT
14 call sub(j,[1,2],3) ! OK, scalar & array IN, array OUT
15 call sub(j,[1,2],[1,2]) ! OK, all arrays
17 call sub(i,1,2) ! OK, only scalar
18 call sub(i,[1,2],3) ! { dg-error "is a scalar" }
19 call sub(i,[1,2],[1,2]) ! { dg-error "is a scalar" }
20 contains
21 elemental subroutine sub(a,b,c)
22 integer :: func, a, b, c
23 intent(in) :: b,c
24 intent(out) :: a
25 a = b +c
26 end subroutine sub
27 end program prog