| 1 |
! RUN: %flang_fc1 -fdebug-unparse %s 2>&1 | FileCheck %s |
| 2 |
subroutine test_storage_size(n) |
| 3 |
interface |
| 4 |
function return_char(l) |
| 5 |
integer :: l |
| 6 |
character(l) :: return_char |
| 7 |
end function |
| 8 |
end interface |
| 9 |
integer n |
| 10 |
!CHECK: PRINT *, storage_size(return_char(n)) |
| 11 |
print*, storage_size(return_char(n)) |
| 12 |
!CHECK: PRINT *, sizeof(return_char(n)) |
| 13 |
print*, sizeof(return_char(n)) |
| 14 |
end subroutine |
| 15 |
|
| 16 |
module pdts |
| 17 |
type t(l) |
| 18 |
integer, len :: l |
| 19 |
character(l) :: c |
| 20 |
end type |
| 21 |
contains |
| 22 |
function return_pdt(n) |
| 23 |
type(t(n)) :: return_pdt |
| 24 |
end function |
| 25 |
subroutine test(k) |
| 26 |
! NOTE: flang design for length parametrized derived type |
| 27 |
! is to use allocatables for the automatic components. Hence, |
| 28 |
! their size is independent from the length parameters and is |
| 29 |
! a compile time constant. |
| 30 |
!CHECK: PRINT *, 192_4 |
| 31 |
print *, storage_size(return_pdt(k)) |
| 32 |
end subroutine |
| 33 |
end module |
| 34 |
|
| 35 |
subroutine test_assumed_rank(x) |
| 36 |
real :: x(..) |
| 37 |
!CHECK: PRINT *, sizeof(x) |
| 38 |
print *, sizeof(x) |
| 39 |
end subroutine |