1! Copyright (c) 2011, NVIDIA CORPORATION.  All rights reserved.
2!
3! Licensed under the Apache License, Version 2.0 (the "License");
4! you may not use this file except in compliance with the License.
5! You may obtain a copy of the License at
6!
7!     http://www.apache.org/licenses/LICENSE-2.0
8!
9! Unless required by applicable law or agreed to in writing, software
10! distributed under the License is distributed on an "AS IS" BASIS,
11! WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12! See the License for the specific language governing permissions and
13! limitations under the License.
14!
15
16module mod_gen
17implicit none
18private
19type, public :: v
20real, allocatable :: r(:)
21end type
22end module
23
24program p
25USE CHECK_MOD
26use mod_gen
27class(v),allocatable ::stuff
28real, allocatable :: r(:)
29class(v),allocatable :: stuff2
30real :: rr(10)
31logical expect(4)
32logical rslt(4)
33
34expect = .true.
35rslt = .false.
36
37allocate(stuff)
38allocate(r(10))
39
40do i=1,10
41r(i) = i
42rr(i) = i
43enddo
44
45allocate(stuff%r(size(rr)),source=r)
46!print *, allocated(stuff%r)
47rslt(1) = allocated(stuff%r)
48allocate(stuff2,source=stuff)
49deallocate(stuff%r)
50!print *,allocated(stuff2%r),allocated(stuff%r)
51rslt(2) = allocated(stuff2%r)
52rslt(3) = .not. allocated(stuff%r)
53!print *, stuff2
54rslt(4) = all(stuff2%r .eq. rr)
55
56call check(rslt,expect,4)
57
58end
59