2014-07-12 Paul Thomas <pault@gcc.gnu.org>
[official-gcc.git] / gcc / testsuite / gfortran.dg / size_optional_dim_1.f90
blobde5a739f56bae88c3b0c706c902c6dc5f3f97acf
1 ! { dg-do run }
2 ! PR 30865 - passing a subroutine optional argument to size(dim=...)
3 ! used to segfault.
4 program main
5 implicit none
6 integer :: a(2,3)
7 integer :: ires
9 call checkv (ires, a)
10 if (ires /= 6) call abort
11 call checkv (ires, a, 1)
12 if (ires /= 2) call abort
13 contains
14 subroutine checkv(ires,a1,opt1)
15 integer, intent(out) :: ires
16 integer :: a1(:,:)
17 integer, optional :: opt1
19 ires = size (a1, dim=opt1)
20 end subroutine checkv
21 end program main