2020-02-14 22:02:29 +08:00
|
|
|
! RUN: %S/test_modfile.sh %s %f18 %t
|
2019-04-06 03:54:19 +08:00
|
|
|
! Test compile-time analysis of shapes.
|
|
|
|
|
|
|
|
module m1
|
2019-08-07 05:14:33 +08:00
|
|
|
integer(8), parameter :: a0s(*) = shape(3.14159)
|
2019-04-06 03:54:19 +08:00
|
|
|
real :: a1(5,5,5)
|
2019-08-07 05:14:33 +08:00
|
|
|
integer(8), parameter :: a1s(*) = shape(a1)
|
|
|
|
integer(8), parameter :: a1ss(*) = shape(a1s)
|
|
|
|
integer(8), parameter :: a1sss(*) = shape(a1ss)
|
|
|
|
integer(8), parameter :: a1rs(*) = [rank(a1),rank(a1s),rank(a1ss),rank(a1sss)]
|
|
|
|
integer(8), parameter :: a1n(*) = [size(a1),size(a1,1),size(a1,2)]
|
|
|
|
integer(8), parameter :: a1sn(*) = [size(a1s),size(a1ss),size(a1sss)]
|
|
|
|
integer(8), parameter :: ac1s(*) = shape([1])
|
|
|
|
integer(8), parameter :: ac2s(*) = shape([1,2,3])
|
|
|
|
integer(8), parameter :: ac3s(*) = shape([(1,j=1,4)])
|
|
|
|
integer(8), parameter :: ac3bs(*) = shape([(1,j=4,1,-1)])
|
|
|
|
integer(8), parameter :: ac4s(*) = shape([((j,k,j*k,k=1,3),j=1,4)])
|
|
|
|
integer(8), parameter :: ac5s(*) = shape([((0,k=5,1,-2),j=9,2,-3)])
|
|
|
|
integer(8), parameter :: rss(*) = shape(reshape([(0,j=1,90)], -[2,3]*(-[5_8,3_8])))
|
2019-04-06 03:54:19 +08:00
|
|
|
contains
|
|
|
|
subroutine subr(x,n1,n2)
|
|
|
|
real, intent(in) :: x(:,:)
|
|
|
|
integer, intent(in) :: n1(3), n2(:)
|
2019-08-07 05:14:33 +08:00
|
|
|
real, allocatable :: a(:,:,:)
|
2019-04-06 03:54:19 +08:00
|
|
|
a = reshape(x,n1)
|
|
|
|
a = reshape(x,n2(10:30:9)) ! fails if we can't figure out triplet shape
|
|
|
|
end subroutine
|
|
|
|
end module m1
|
|
|
|
!Expect: m1.mod
|
|
|
|
! module m1
|
2020-01-07 06:04:17 +08:00
|
|
|
! integer(8),parameter::a0s(1_8:*)=[INTEGER(8)::]
|
2019-12-26 04:29:50 +08:00
|
|
|
! intrinsic::shape
|
2019-04-06 03:54:19 +08:00
|
|
|
! real(4)::a1(1_8:5_8,1_8:5_8,1_8:5_8)
|
2020-01-07 06:04:17 +08:00
|
|
|
! integer(8),parameter::a1s(1_8:*)=[INTEGER(8)::5_8,5_8,5_8]
|
|
|
|
! integer(8),parameter::a1ss(1_8:*)=[INTEGER(8)::3_8]
|
|
|
|
! integer(8),parameter::a1sss(1_8:*)=[INTEGER(8)::1_8]
|
|
|
|
! integer(8),parameter::a1rs(1_8:*)=[INTEGER(8)::3_8,1_8,1_8,1_8]
|
|
|
|
! integer(8),parameter::a1n(1_8:*)=[INTEGER(8)::125_8,5_8,5_8]
|
|
|
|
! integer(8),parameter::a1sn(1_8:*)=[INTEGER(8)::3_8,1_8,1_8]
|
|
|
|
! integer(8),parameter::ac1s(1_8:*)=[INTEGER(8)::1_8]
|
|
|
|
! integer(8),parameter::ac2s(1_8:*)=[INTEGER(8)::3_8]
|
|
|
|
! integer(8),parameter::ac3s(1_8:*)=[INTEGER(8)::4_8]
|
|
|
|
! integer(8),parameter::ac3bs(1_8:*)=[INTEGER(8)::4_8]
|
|
|
|
! integer(8),parameter::ac4s(1_8:*)=[INTEGER(8)::36_8]
|
|
|
|
! integer(8),parameter::ac5s(1_8:*)=[INTEGER(8)::9_8]
|
|
|
|
! integer(8),parameter::rss(1_8:*)=[INTEGER(8)::10_8,9_8]
|
2019-12-26 04:29:50 +08:00
|
|
|
! intrinsic::reshape
|
2019-04-06 03:54:19 +08:00
|
|
|
! contains
|
|
|
|
! subroutine subr(x,n1,n2)
|
2019-08-07 05:14:33 +08:00
|
|
|
! real(4),intent(in)::x(:,:)
|
2019-04-06 03:54:19 +08:00
|
|
|
! integer(4),intent(in)::n1(1_8:3_8)
|
2019-08-07 05:14:33 +08:00
|
|
|
! integer(4),intent(in)::n2(:)
|
2019-04-06 03:54:19 +08:00
|
|
|
! end
|
|
|
|
! end
|