2017-12-08 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gfortran.dg / argument_checking_5.f90
blobf19d9aa44e08943e7f54338feb2c3f60eddf5571
1 ! { dg-do compile }
3 ! PR fortran/30940
4 program test
5 implicit none
6 interface
7 subroutine foobar(x)
8 integer,dimension(4) :: x
9 end subroutine foobar
10 subroutine arr(y)
11 integer,dimension(1,2,1,2) :: y
12 end subroutine arr
13 end interface
15 integer a(3), b(5)
16 call foobar(a) ! { dg-error "contains too few elements" }
17 call foobar(b)
18 call foobar(b(1:3)) ! { dg-error "contains too few elements" }
19 call foobar(b(1:5))
20 call foobar(b(1:5:2)) ! { dg-error "contains too few elements" }
21 call foobar(b(2))
22 call foobar(b(3)) ! { dg-error "Actual argument contains too few elements" }
23 call foobar(reshape(a(1:3),[2,1])) ! { dg-error "contains too few elements" }
24 call foobar(reshape(b(2:5),[2,2]))
26 call arr(a) ! { dg-error "contains too few elements" }
27 call arr(b)
28 call arr(b(1:3)) ! { dg-error "contains too few elements" }
29 call arr(b(1:5))
30 call arr(b(1:5:2)) ! { dg-error "contains too few elements" }
31 call arr(b(2))
32 call arr(b(3)) ! { dg-error "contains too few elements" }
33 call arr(reshape(a(1:3),[2,1])) ! { dg-error "contains too few elements" }
34 call arr(reshape(b(2:5),[2,2]))
35 end program test