arm: Add .type and .size to __gnu_cmse_nonsecure_call [PR115360]
[official-gcc.git] / gcc / testsuite / gfortran.dg / class_dummy_6.f90
blob79f6e86daa70b04f8339bf9017ce66d944348112
1 ! { dg-do run }
3 ! Test the fix for PR99819 - explicit shape class arrays in different
4 ! procedures caused an ICE.
6 ! Contributed by Gerhard Steinmetz <gscfq@t-online.de>
8 program p
9 type t
10 integer :: i
11 end type
12 class(t), allocatable :: dum1(:), dum2(:), dum3(:,:)
14 allocate (t :: dum1(3), dum2(10), dum3(2,5))
15 dum2%i = [1,2,3,4,5,6,7,8,9,10]
16 dum3%i = reshape ([1,2,3,4,5,6,7,8,9,10],[2,5])
18 ! Somewhat elaborated versions of the PR procedures.
19 if (f (dum1, dum2, dum3) .ne. 10) stop 1
20 if (g (dum1) .ne. 3) stop 2
22 ! Test the original versions of the procedures.
23 if (f_original (dum1, dum2) .ne. 3) stop 3
24 if (g_original (dum2) .ne. 10) stop 4
26 contains
27 integer function f(x, y, z)
28 class(t) :: x(:)
29 class(t) :: y(size( x))
30 class(t) :: z(2,*)
31 if (size (y) .ne. 3) stop 5
32 if (size (z) .ne. 0) stop 6
33 select type (y)
34 type is (t)
35 f = 1
36 if (any (y%i .ne. [1,2,3])) stop 7
37 class default
38 f = 0
39 end select
40 select type (z)
41 type is (t)
42 f = f*10
43 if (any (z(1,1:4)%i .ne. [1,3,5,7])) stop 8
44 class default
45 f = 0
46 end select
47 end
48 integer function g(z)
49 class(t) :: z(:)
50 type(t) :: u(size(z))
51 g = size (u)
52 end
54 integer function f_original(x, y)
55 class(t) :: x(:)
56 class(*) :: y(size (x))
57 f_original = size (y)
58 end
60 integer function g_original(z)
61 class(*) :: z(:)
62 type(t) :: u(size(z))
63 g_original = size (u)
64 end
65 end