1 ! { dg-do run { target c99_runtime } }
2 ! { dg-additional-sources ISO_Fortran_binding_11.c }
4 ! Test the fix of PR89846.
6 ! Contributed by Reinhold Bader <Bader@lrz.de>
9 use, intrinsic :: iso_c_binding
11 integer, parameter :: nelem
= 5
13 character(c_char
) :: n
21 subroutine ti(this
, flag
) bind(c
)
24 integer(c_int
), value
:: flag
28 subroutine ta0(this
) bind(c
)
30 integer :: i
, iw
, status
32 if (size(this
) /= nelem
) then
33 write(*,*) 'FAIL 1: ',size(this
)
38 if (this(i
)%n
/= char(i
,c_char
) .or
. this(i
)%r(1) /= real(i
,c_float
) .or
. &
39 this(i
)%r(2) /= real(i
+1,c_float
)) then
44 write(*,*) 'FAIL 2: ' ,this
47 if (status
/= 0) stop 1
49 subroutine ta1(this
) bind(c
)
50 integer(c_long
) :: this(:)
53 if (size(this
) /= nelem
) then
54 write(*,*) 'FAIL 3: ',size(this
)
57 if (maxval(abs(this
- [ (int(i
,c_long
),i
=1,nelem
) ])) > 0) then
58 write(*,*) 'FAIL 4: ' ,this
61 if (status
/= 0) stop 2
63 end module mod_subobj_01
69 type(t2
), allocatable
:: o_t2(:)
73 o_t2(i
)%t1
= t1( char(i
,c_char
), [ real(i
,c_float
), real(i
+1,c_float
) ] )
74 o_t2(i
)%i
= int(i
,c_long
)