* config/sparc/driver-sparc.c (cpu_names): Add SPARC-T5 entry.
[official-gcc.git] / gcc / testsuite / gfortran.dg / c_sizeof_1.f90
blobd601f1ec8ecd6b101162db99aeab61da677acef5
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) call abort()
16 i = c_sizeof(j)
17 if (i /= 40) call abort()
19 i = c_sizeof(str2)
20 if (i /= 4) call abort()
22 i = c_sizeof(str2(1))
23 if (i /= 1) call abort()
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) call abort()
31 i = sizeof(j)
32 if (i /= 40) call abort()
34 i = sizeof(str)
35 if (i /= 4) call abort()
37 i = sizeof(str(1))
38 if (i /= 4) call abort()
40 i = sizeof(str(1)(1:3))
41 if (i /= 3) call abort()
43 end