summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/argument_checking_5.f90
blob: 3715b30cf464227d701185f0946f6d64b6cf8717 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
! { dg-do compile }
!
! PR fortran/30940
program test
implicit none
interface
  subroutine foobar(x)
     integer,dimension(4) :: x
  end subroutine foobar
  subroutine arr(y)
     integer,dimension(1,2,1,2) :: y
  end subroutine arr
end interface

integer a(3), b(5)
call foobar(a) ! { dg-warning "contains too few elements" }
call foobar(b)
call foobar(b(1:3)) ! { dg-warning "contains too few elements" }
call foobar(b(1:5))
call foobar(b(1:5:2)) ! { dg-warning "contains too few elements" }
call foobar(b(2))
call foobar(b(3)) ! { dg-warning "Actual argument contains too few elements" }
call foobar(reshape(a(1:3),[2,1])) ! { dg-warning "contains too few elements" }
call foobar(reshape(b(2:5),[2,2]))

call arr(a) ! { dg-warning "contains too few elements" }
call arr(b)
call arr(b(1:3)) ! { dg-warning "contains too few elements" }
call arr(b(1:5))
call arr(b(1:5:2)) ! { dg-warning "contains too few elements" }
call arr(b(2))
call arr(b(3)) ! { dg-warning "contains too few elements" }
call arr(reshape(a(1:3),[2,1])) ! { dg-warning "contains too few elements" }
call arr(reshape(b(2:5),[2,2]))
end program test