1 |
694 |
jeremybenn |
! { 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) call abort()
|
45 |
|
|
if(my_int /= 2_c_int) call abort()
|
46 |
|
|
if(my_long /= 3_c_long) call abort()
|
47 |
|
|
if(my_long_long /= 4_c_long_long) call abort()
|
48 |
|
|
|
49 |
|
|
if(my_int8_t /= 1_c_int8_t) call abort()
|
50 |
|
|
if(my_int_least8_t /= 2_c_int_least8_t ) call abort()
|
51 |
|
|
if(my_int_fast8_t /= 3_c_int_fast8_t ) call abort()
|
52 |
|
|
|
53 |
|
|
if(my_int16_t /= 1_c_int16_t) call abort()
|
54 |
|
|
if(my_int_least16_t /= 2_c_int_least16_t) call abort()
|
55 |
|
|
if(my_int_fast16_t /= 3_c_int_fast16_t ) call abort()
|
56 |
|
|
|
57 |
|
|
if(my_int32_t /= 1_c_int32_t) call abort()
|
58 |
|
|
if(my_int_least32_t /= 2_c_int_least32_t) call abort()
|
59 |
|
|
if(my_int_fast32_t /= 3_c_int_fast32_t ) call abort()
|
60 |
|
|
|
61 |
|
|
if(my_int64_t /= 1_c_int64_t) call abort()
|
62 |
|
|
if(my_int_least64_t /= 2_c_int_least64_t) call abort()
|
63 |
|
|
if(my_int_fast64_t /= 3_c_int_fast64_t ) call abort()
|
64 |
|
|
|
65 |
|
|
if(my_intmax_t /= 1_c_intmax_t) call abort()
|
66 |
|
|
if(my_intptr_t /= 0_c_intptr_t) call abort()
|
67 |
|
|
|
68 |
|
|
if(my_float /= 1.0_c_float) call abort()
|
69 |
|
|
if(my_double /= 2.0_c_double) call abort()
|
70 |
|
|
if(my_long_double /= 3.0_c_long_double) call abort()
|
71 |
|
|
|
72 |
|
|
if(my_char /= c_char_'y') call abort()
|
73 |
|
|
if(my_bool .neqv. .true._c_bool) call abort()
|
74 |
|
|
end subroutine param_test
|
75 |
|
|
|
76 |
|
|
end module c_kind_params
|
77 |
|
|
! { dg-final { cleanup-modules "c_kind_params" } }
|