Increase timeout factor for hppa*-*-* in gcc.dg/long_branch.c
[official-gcc.git] / gcc / testsuite / gfortran.dg / c_sizeof_1.f90
blobea36c20f458ee3b5a3bde174434f1e2045cd6bff
1 ! { dg-do run }
2 ! Support F2008's c_sizeof()
4 use iso_c_binding, only: c_int, c_char, c_ptr, c_intptr_t, c_null_ptr, c_sizeof
6 integer(kind=c_int) :: i, j(10)
7 character(kind=c_char,len=4),parameter :: str(1 ) = "abcd"
8 character(kind=c_char,len=1),parameter :: str2(4) = ["a","b","c","d"]
9 type(c_ptr) :: cptr
10 integer(c_intptr_t) :: iptr
12 ! Using F2008's C_SIZEOF
13 i = c_sizeof(i)
14 if (i /= 4) STOP 1
16 i = c_sizeof(j)
17 if (i /= 40) STOP 2
19 i = c_sizeof(str2)
20 if (i /= 4) STOP 3
22 i = c_sizeof(str2(1))
23 if (i /= 1) STOP 4
25 write(*,*) c_sizeof(cptr), c_sizeof(iptr), c_sizeof(C_NULL_PTR)
27 ! Using GNU's SIZEOF
28 i = sizeof(i)
29 if (i /= 4) STOP 5
31 i = sizeof(j)
32 if (i /= 40) STOP 6
34 i = sizeof(str)
35 if (i /= 4) STOP 7
37 i = sizeof(str(1))
38 if (i /= 4) STOP 8
40 i = sizeof(str(1)(1:3))
41 if (i /= 3) STOP 9
43 end