2009-10-05 Paul Thomas <pault@gcc.gnu.org>
[official-gcc.git] / gcc / testsuite / gfortran.dg / c_sizeof_1.f90
blobf2a5caf68647f6a91cd6b7ee112d1d760f97b59a
1 ! { dg-do run }
2 ! Support F2008's c_sizeof()
4 integer(4) :: i, j(10)
5 character(4),parameter :: str(1) = "abcd"
7 ! Using F2008's C_SIZEOF
8 i = c_sizeof(i)
9 if (i /= 4) call abort()
11 i = c_sizeof(j)
12 if (i /= 40) call abort()
14 i = c_sizeof(str)
15 if (i /= 4) call abort()
17 i = c_sizeof(str(1))
18 if (i /= 4) call abort()
20 i = c_sizeof(str(1)(1:3))
21 print *, i
22 if (i /= 3) call abort()
24 ! Using GNU's SIZEOF
25 i = sizeof(i)
26 if (i /= 4) call abort()
28 i = sizeof(j)
29 if (i /= 40) call abort()
31 i = sizeof(str)
32 if (i /= 4) call abort()
34 i = sizeof(str(1))
35 if (i /= 4) call abort()
37 i = sizeof(str(1)(1:3))
38 if (i /= 3) call abort()
39 end