[C++ PATCH] Deprecate -ffriend-injection
[official-gcc.git] / gcc / testsuite / gfortran.dg / sizeof_4.f90
blobd4d8baa8d04548cba13f54c588549a9e08f4ca51
1 ! { dg-do run }
3 ! PR fortran/61881
4 ! PR fortran/61888
7 use iso_c_binding
8 implicit none
10 call dim0(5, 4)
12 call dim1([1, 2, 3], 4*3)
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)
18 call tdim1([1, 2, 3], 4*3)
19 call tdim1([1_8, 2_8, 3_8], 8*3)
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)
28 call cdim0(5, 4)
30 call cdim1([1, 2, 3], 4*3)
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)
39 contains
41 subroutine dim0(x, expected_size)
42 integer :: x
43 integer, value :: expected_size
44 if (sizeof(x) /= expected_size) call abort()
45 if (storage_size(x)/8 /= expected_size) call abort()
46 end
48 subroutine dim1(x, expected_size)
49 integer, dimension(:) :: x
50 integer, value :: expected_size
51 if (sizeof(x) /= expected_size) call abort()
52 if (storage_size(x)/8*size(x) /= expected_size) call abort()
53 end
55 subroutine dimd(x, expected_size)
56 integer, dimension(..) :: x
57 integer, value :: expected_size
58 if (sizeof(x) /= expected_size) call abort()
59 if (storage_size(x)/8*size(x) /= expected_size) call abort()
60 end
62 subroutine cdim0(x, expected_size)
63 class(*) :: x
64 integer, value :: expected_size
65 if (sizeof(x) /= expected_size) call abort()
66 if (storage_size(x)/8 /= expected_size) call abort()
67 end
69 subroutine cdim1(x, expected_size)
70 class(*), dimension(:) :: x
71 integer, value :: expected_size
72 if (sizeof(x) /= expected_size) call abort()
73 if (storage_size(x)/8*size(x) /= expected_size) call abort()
74 end
76 subroutine cdimd(x, expected_size)
77 class(*), dimension(..) :: x
78 integer, value :: expected_size
79 if (sizeof(x) /= expected_size) call abort()
80 if (storage_size(x)/8*size(x) /= expected_size) call abort()
81 end
83 subroutine tdim1(x, expected_size)
84 type(*), dimension(:) :: x
85 integer, value :: expected_size
86 if (sizeof(x) /= expected_size) call abort()
87 end
89 subroutine tdimd(x, expected_size)
90 type(*), dimension(..) :: x
91 integer, value :: expected_size
92 if (sizeof(x) /= expected_size) call abort()
93 end
95 end