| 1 |
! { dg-lto-do run } |
| 2 |
! { dg-lto-options {{ -O3 -flto }} } |
| 3 |
! This testcase will abort if real/complex/boolean/character types are not interoperable |
| 4 |
module lto_type_merge_test |
| 5 |
use, intrinsic :: iso_c_binding |
| 6 |
implicit none |
| 7 |
|
| 8 |
type, bind(c) :: MYFTYPE_1 |
| 9 |
real(c_float) :: val_1 |
| 10 |
real(c_double) :: val_2 |
| 11 |
real(c_long_double) :: val_3 |
| 12 |
complex(c_float_complex) :: val_4 |
| 13 |
complex(c_double_complex) :: val_5 |
| 14 |
complex(c_long_double_complex) :: val_6 |
| 15 |
logical(c_bool) :: val_7 |
| 16 |
!FIXME: Fortran define c_char as array of size 1. |
| 17 |
!character(c_char) :: val_8 |
| 18 |
end type MYFTYPE_1 |
| 19 |
|
| 20 |
type(myftype_1), bind(c, name="myVar") :: myVar |
| 21 |
|
| 22 |
contains |
| 23 |
subroutine types_test1() bind(c) |
| 24 |
myVar%val_1 = 2 |
| 25 |
end subroutine types_test1 |
| 26 |
subroutine types_test2() bind(c) |
| 27 |
myVar%val_2 = 2 |
| 28 |
end subroutine types_test2 |
| 29 |
subroutine types_test3() bind(c) |
| 30 |
myVar%val_3 = 2 |
| 31 |
end subroutine types_test3 |
| 32 |
subroutine types_test4() bind(c) |
| 33 |
myVar%val_4 = 2 |
| 34 |
end subroutine types_test4 |
| 35 |
subroutine types_test5() bind(c) |
| 36 |
myVar%val_5 = 2 |
| 37 |
end subroutine types_test5 |
| 38 |
subroutine types_test6() bind(c) |
| 39 |
myVar%val_6 = 2 |
| 40 |
end subroutine types_test6 |
| 41 |
subroutine types_test7() bind(c) |
| 42 |
myVar%val_7 = myVar%val_7 .or. .not. myVar%val_7 |
| 43 |
end subroutine types_test7 |
| 44 |
!subroutine types_test8() bind(c) |
| 45 |
!myVar%val_8 = "a" |
| 46 |
!end subroutine types_test8 |
| 47 |
end module lto_type_merge_test |
| 48 |
|