| 1 |
! { dg-do run } |
| 2 |
! |
| 3 |
! PR fortran/61881 |
| 4 |
! PR fortran/61888 |
| 5 |
! |
| 6 |
! |
| 7 |
use iso_c_binding |
| 8 |
implicit none |
| 9 |
|
| 10 |
call dim0(5, 4) |
| 11 |
|
| 12 |
call dim1([1, 2, 3], 4*3) |
| 13 |
|
| 14 |
call dimd(5, 4) |
| 15 |
call dimd([1, 2, 3], 4*3) |
| 16 |
call dimd(reshape([1, 4, 2, 3],[2, 2]), 4*4) |
| 17 |
|
| 18 |
call tdim1([1, 2, 3], 4*3) |
| 19 |
call tdim1([1_8, 2_8, 3_8], 8*3) |
| 20 |
|
| 21 |
call tdimd(5, 4) |
| 22 |
call tdimd([1, 2, 3], 4*3) |
| 23 |
call tdimd(reshape([1, 4, 2, 3], [2, 2]), 4*4) |
| 24 |
call tdimd(5_8, 8) |
| 25 |
call tdimd([1_8, 2_8, 3_8], 8*3) |
| 26 |
call tdimd(reshape([1_8, 4_8, 2_8, 3_8],[2,2]), 8*4) |
| 27 |
|
| 28 |
call cdim0(5, 4) |
| 29 |
|
| 30 |
call cdim1([1, 2, 3], 4*3) |
| 31 |
|
| 32 |
call cdimd(5, 4) |
| 33 |
call cdimd([1, 2, 3], 4*3) |
| 34 |
call cdimd(reshape([1,4,2,3],[2,2]), 4*4) |
| 35 |
call cdimd(5_8, 8) |
| 36 |
call cdimd([1_8, 2_8, 3_8], 8*3) |
| 37 |
call cdimd(reshape([1_8, 4_8, 2_8, 3_8], [2, 2]), 8*4) |
| 38 |
|
| 39 |
contains |
| 40 |
|
| 41 |
subroutine dim0(x, expected_size) |
| 42 |
integer :: x |
| 43 |
integer, value :: expected_size |
| 44 |
if (sizeof(x) /= expected_size) STOP 1 |
| 45 |
if (storage_size(x)/8 /= expected_size) STOP 2 |
| 46 |
end |
| 47 |
|
| 48 |
subroutine dim1(x, expected_size) |
| 49 |
integer, dimension(:) :: x |
| 50 |
integer, value :: expected_size |
| 51 |
if (sizeof(x) /= expected_size) STOP 3 |
| 52 |
if (storage_size(x)/8*size(x) /= expected_size) STOP 4 |
| 53 |
end |
| 54 |
|
| 55 |
subroutine dimd(x, expected_size) |
| 56 |
integer, dimension(..) :: x |
| 57 |
integer, value :: expected_size |
| 58 |
if (sizeof(x) /= expected_size) STOP 5 |
| 59 |
if (storage_size(x)/8*size(x) /= expected_size) STOP 6 |
| 60 |
end |
| 61 |
|
| 62 |
subroutine cdim0(x, expected_size) |
| 63 |
class(*) :: x |
| 64 |
integer, value :: expected_size |
| 65 |
if (sizeof(x) /= expected_size) STOP 7 |
| 66 |
if (storage_size(x)/8 /= expected_size) STOP 8 |
| 67 |
end |
| 68 |
|
| 69 |
subroutine cdim1(x, expected_size) |
| 70 |
class(*), dimension(:) :: x |
| 71 |
integer, value :: expected_size |
| 72 |
if (sizeof(x) /= expected_size) STOP 9 |
| 73 |
if (storage_size(x)/8*size(x) /= expected_size) STOP 10 |
| 74 |
end |
| 75 |
|
| 76 |
subroutine cdimd(x, expected_size) |
| 77 |
class(*), dimension(..) :: x |
| 78 |
integer, value :: expected_size |
| 79 |
if (sizeof(x) /= expected_size) STOP 11 |
| 80 |
if (storage_size(x)/8*size(x) /= expected_size) STOP 12 |
| 81 |
end |
| 82 |
|
| 83 |
subroutine tdim1(x, expected_size) |
| 84 |
type(*), dimension(:) :: x |
| 85 |
integer, value :: expected_size |
| 86 |
if (sizeof(x) /= expected_size) STOP 13 |
| 87 |
end |
| 88 |
|
| 89 |
subroutine tdimd(x, expected_size) |
| 90 |
type(*), dimension(..) :: x |
| 91 |
integer, value :: expected_size |
| 92 |
if (sizeof(x) /= expected_size) STOP 14 |
| 93 |
end |
| 94 |
|
| 95 |
end |