1! Copyright (c) 2012, 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 17logical expect(20), rslt(20) 18type :: objects(k1,k2,l1) 19integer, kind :: k1 = 3 20integer, kind :: k2 = selected_char_kind("ASCII") 21integer, len :: l1 22character(kind=k2,len=l1) :: c 23integer z 24end type 25contains 26integer function check_dt(z,x) 27type(objects(k2=1,k1=3,l1=:)),allocatable:: x 28integer z 29!type(objects(k2=1,k1=3,l1=*)):: x 30!print *, x%c, kind(x%c), len(x%c), x%l1, x%z, z 31rslt(14) = x%c .eq. 'abcd' 32rslt(15) = kind(x%c) .eq. 1 33rslt(16) = len(x%c) .eq. 4 34rslt(17) = x%l1 .eq. 4 35rslt(18) = x%z .eq. 999 36rslt(19) = z .eq. 999 37check_dt = x%z 38end function 39 40end module 41 42program p 43use mod 44integer i 45type(objects(l1=:)),allocatable :: x 46type(objects(k2=1,k1=3,l1=4)) :: y 47 48allocate(objects(k2=1,k1=3,l1=4) :: x) 49 50x%c = 'abcd' 51 52expect = .true. 53 54!print *, x%c, kind(x%c), len(x%c) 55rslt(1) = kind(x%c) .eq. selected_char_kind("ASCII") 56rslt(2) = len(x%c) .eq. 4 57rslt(3) = x%c .eq. 'abcd' 58 59 60x%z = 999 61y%c = x%c 62y%z = x%z 63rslt(4) = x%c .eq. 'abcd' 64rslt(5) = kind(x%c) .eq. 1 65rslt(6) = len(x%c) .eq. 4 66rslt(7) = x%l1 .eq. 4 67rslt(8) = x%z .eq. 999 68rslt(9) = y%c .eq. 'abcd' 69rslt(10) = kind(y%c) .eq. 1 70rslt(11) = len(y%c) .eq. 4 71rslt(12) = y%l1 .eq. 4 72rslt(13) = y%z .eq. 999 73 74!print *, x%c, kind(x%c), len(x%c), x%l1, x%z 75!print *, y%c, kind(y%c), len(y%c), y%l1, y%z 76i = check_dt(x%z,x) 77rslt(20) = i .eq. 999 78!i = check_dt(y%z,y) 79!print *, 'rslt =',i 80call check(rslt,expect,20) 81 82end 83