OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gfortran.dg/] [c_sizeof_1.f90] - Blame information for rev 694

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 694 jeremybenn
! { dg-do run }
2
! Support F2008's c_sizeof()
3
!
4
use iso_c_binding, only: c_int, c_char, c_ptr, c_intptr_t, c_null_ptr, c_sizeof
5
 
6
integer(kind=c_int) :: i, j(10)
7
character(kind=c_char,len=4),parameter :: str(1) = "abcd"
8
type(c_ptr) :: cptr
9
integer(c_intptr_t) :: iptr
10
 
11
! Using F2008's C_SIZEOF
12
i = c_sizeof(i)
13
if (i /= 4) call abort()
14
 
15
i = c_sizeof(j)
16
if (i /= 40) call abort()
17
 
18
i = c_sizeof(str)
19
if (i /= 4) call abort()
20
 
21
i = c_sizeof(str(1))
22
if (i /= 4) call abort()
23
 
24
i = c_sizeof(str(1)(1:3))
25
if (i /= 3) call abort()
26
 
27
write(*,*) c_sizeof(cptr), c_sizeof(iptr), c_sizeof(C_NULL_PTR)
28
 
29
! Using GNU's SIZEOF
30
i = sizeof(i)
31
if (i /= 4) call abort()
32
 
33
i = sizeof(j)
34
if (i /= 40) call abort()
35
 
36
i = sizeof(str)
37
if (i /= 4) call abort()
38
 
39
i = sizeof(str(1))
40
if (i /= 4) call abort()
41
 
42
i = sizeof(str(1)(1:3))
43
if (i /= 3) call abort()
44
 
45
end
46
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.