]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/gfortran.dg/pdt_28.f03
2019-01-22 Manfred Schwarb <manfred99@gmx.ch>
[thirdparty/gcc.git] / gcc / testsuite / gfortran.dg / pdt_28.f03
1 ! { dg-do run }
2 ! { dg-options "-fbounds-check" }
3 !
4 ! Test the fix for PR83731, where the following failed on the check for the
5 ! value of the parameter 'k'.
6 !
7 ! Contributed by Berke Durak <berke.durak@gmail.com>
8 !
9 module pdt_m
10 implicit none
11 type :: vec(k)
12 integer, len :: k=10
13 integer :: foo(k)
14 end type vec
15 contains
16 function total(a)
17 type(vec(k=*)), intent(in) :: a ! Would compare with the default initializer.
18 integer :: total
19
20 total=sum(a%foo)
21 end function total
22 end module pdt_m
23
24 program test_pdt
25 use pdt_m
26 implicit none
27 type(vec(k=123)) :: u
28
29 u%foo=1
30 if (total(u) .ne. u%k) STOP 1
31 end program test_pdt