| 1 |
! { dg-do run } |
| 2 |
! { dg-require-effective-target stdint_types } |
| 3 |
! { dg-additional-sources c_kinds.c } |
| 4 |
! { dg-options "-w -std=c99" } |
| 5 |
! the -w option is needed to make f951 not report a warning for |
| 6 |
! the -std=c99 option that the C file needs. |
| 7 |
! |
| 8 |
module c_kind_params |
| 9 |
use, intrinsic :: iso_c_binding |
| 10 |
implicit none |
| 11 |
|
| 12 |
contains |
| 13 |
subroutine param_test(my_short, my_int, my_long, my_long_long, & |
| 14 |
my_int8_t, my_int_least8_t, my_int_fast8_t, & |
| 15 |
my_int16_t, my_int_least16_t, my_int_fast16_t, & |
| 16 |
my_int32_t, my_int_least32_t, my_int_fast32_t, & |
| 17 |
my_int64_t, my_int_least64_t, my_int_fast64_t, & |
| 18 |
my_intmax_t, my_intptr_t, my_float, my_double, my_long_double, & |
| 19 |
my_char, my_bool) bind(c) |
| 20 |
integer(c_short), value :: my_short |
| 21 |
integer(c_int), value :: my_int |
| 22 |
integer(c_long), value :: my_long |
| 23 |
integer(c_long_long), value :: my_long_long |
| 24 |
integer(c_int8_t), value :: my_int8_t |
| 25 |
integer(c_int_least8_t), value :: my_int_least8_t |
| 26 |
integer(c_int_fast8_t), value :: my_int_fast8_t |
| 27 |
integer(c_int16_t), value :: my_int16_t |
| 28 |
integer(c_int_least16_t), value :: my_int_least16_t |
| 29 |
integer(c_int_fast16_t), value :: my_int_fast16_t |
| 30 |
integer(c_int32_t), value :: my_int32_t |
| 31 |
integer(c_int_least32_t), value :: my_int_least32_t |
| 32 |
integer(c_int_fast32_t), value :: my_int_fast32_t |
| 33 |
integer(c_int64_t), value :: my_int64_t |
| 34 |
integer(c_int_least64_t), value :: my_int_least64_t |
| 35 |
integer(c_int_fast64_t), value :: my_int_fast64_t |
| 36 |
integer(c_intmax_t), value :: my_intmax_t |
| 37 |
integer(c_intptr_t), value :: my_intptr_t |
| 38 |
real(c_float), value :: my_float |
| 39 |
real(c_double), value :: my_double |
| 40 |
real(c_long_double), value :: my_long_double |
| 41 |
character(c_char), value :: my_char |
| 42 |
logical(c_bool), value :: my_bool |
| 43 |
|
| 44 |
if(my_short /= 1_c_short) STOP 1 |
| 45 |
if(my_int /= 2_c_int) STOP 2 |
| 46 |
if(my_long /= 3_c_long) STOP 3 |
| 47 |
if(my_long_long /= 4_c_long_long) STOP 4 |
| 48 |
|
| 49 |
if(my_int8_t /= 1_c_int8_t) STOP 5 |
| 50 |
if(my_int_least8_t /= 2_c_int_least8_t ) STOP 6 |
| 51 |
if(my_int_fast8_t /= 3_c_int_fast8_t ) STOP 7 |
| 52 |
|
| 53 |
if(my_int16_t /= 1_c_int16_t) STOP 8 |
| 54 |
if(my_int_least16_t /= 2_c_int_least16_t) STOP 9 |
| 55 |
if(my_int_fast16_t /= 3_c_int_fast16_t ) STOP 10 |
| 56 |
|
| 57 |
if(my_int32_t /= 1_c_int32_t) STOP 11 |
| 58 |
if(my_int_least32_t /= 2_c_int_least32_t) STOP 12 |
| 59 |
if(my_int_fast32_t /= 3_c_int_fast32_t ) STOP 13 |
| 60 |
|
| 61 |
if(my_int64_t /= 1_c_int64_t) STOP 14 |
| 62 |
if(my_int_least64_t /= 2_c_int_least64_t) STOP 15 |
| 63 |
if(my_int_fast64_t /= 3_c_int_fast64_t ) STOP 16 |
| 64 |
|
| 65 |
if(my_intmax_t /= 1_c_intmax_t) STOP 17 |
| 66 |
if(my_intptr_t /= 0_c_intptr_t) STOP 18 |
| 67 |
|
| 68 |
if(my_float /= 1.0_c_float) STOP 19 |
| 69 |
if(my_double /= 2.0_c_double) STOP 20 |
| 70 |
if(my_long_double /= 3.0_c_long_double) STOP 21 |
| 71 |
|
| 72 |
if(my_char /= c_char_'y') STOP 22 |
| 73 |
if(my_bool .neqv. .true._c_bool) STOP 23 |
| 74 |
end subroutine param_test |
| 75 |
|
| 76 |
end module c_kind_params |