diff options
author | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
---|---|---|
committer | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
commit | 554fd8c5195424bdbcabf5de30fdc183aba391bd (patch) | |
tree | 976dc5ab7fddf506dadce60ae936f43f58787092 /gcc/testsuite/gfortran.dg/c_kind_params.f90 | |
download | cbb-gcc-4.6.4-upstream.tar.bz2 cbb-gcc-4.6.4-upstream.tar.xz |
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig;
imported gcc-4.6.4 source tree from verified upstream tarball.
downloading a git-generated archive based on the 'upstream' tag
should provide you with a source tree that is binary identical
to the one extracted from the above tarball.
if you have obtained the source via the command 'git clone',
however, do note that line-endings of files in your working
directory might differ from line-endings of the respective
files in the upstream repository.
Diffstat (limited to 'gcc/testsuite/gfortran.dg/c_kind_params.f90')
-rw-r--r-- | gcc/testsuite/gfortran.dg/c_kind_params.f90 | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/c_kind_params.f90 b/gcc/testsuite/gfortran.dg/c_kind_params.f90 new file mode 100644 index 000000000..417615788 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/c_kind_params.f90 @@ -0,0 +1,77 @@ +! { dg-do run } +! { dg-require-effective-target stdint_types } +! { dg-additional-sources c_kinds.c } +! { dg-options "-w -std=c99" } +! the -w option is needed to make f951 not report a warning for +! the -std=c99 option that the C file needs. +! +module c_kind_params + use, intrinsic :: iso_c_binding + implicit none + +contains + subroutine param_test(my_short, my_int, my_long, my_long_long, & + my_int8_t, my_int_least8_t, my_int_fast8_t, & + my_int16_t, my_int_least16_t, my_int_fast16_t, & + my_int32_t, my_int_least32_t, my_int_fast32_t, & + my_int64_t, my_int_least64_t, my_int_fast64_t, & + my_intmax_t, my_intptr_t, my_float, my_double, my_long_double, & + my_char, my_bool) bind(c) + integer(c_short), value :: my_short + integer(c_int), value :: my_int + integer(c_long), value :: my_long + integer(c_long_long), value :: my_long_long + integer(c_int8_t), value :: my_int8_t + integer(c_int_least8_t), value :: my_int_least8_t + integer(c_int_fast8_t), value :: my_int_fast8_t + integer(c_int16_t), value :: my_int16_t + integer(c_int_least16_t), value :: my_int_least16_t + integer(c_int_fast16_t), value :: my_int_fast16_t + integer(c_int32_t), value :: my_int32_t + integer(c_int_least32_t), value :: my_int_least32_t + integer(c_int_fast32_t), value :: my_int_fast32_t + integer(c_int64_t), value :: my_int64_t + integer(c_int_least64_t), value :: my_int_least64_t + integer(c_int_fast64_t), value :: my_int_fast64_t + integer(c_intmax_t), value :: my_intmax_t + integer(c_intptr_t), value :: my_intptr_t + real(c_float), value :: my_float + real(c_double), value :: my_double + real(c_long_double), value :: my_long_double + character(c_char), value :: my_char + logical(c_bool), value :: my_bool + + if(my_short /= 1_c_short) call abort() + if(my_int /= 2_c_int) call abort() + if(my_long /= 3_c_long) call abort() + if(my_long_long /= 4_c_long_long) call abort() + + if(my_int8_t /= 1_c_int8_t) call abort() + if(my_int_least8_t /= 2_c_int_least8_t ) call abort() + if(my_int_fast8_t /= 3_c_int_fast8_t ) call abort() + + if(my_int16_t /= 1_c_int16_t) call abort() + if(my_int_least16_t /= 2_c_int_least16_t) call abort() + if(my_int_fast16_t /= 3_c_int_fast16_t ) call abort() + + if(my_int32_t /= 1_c_int32_t) call abort() + if(my_int_least32_t /= 2_c_int_least32_t) call abort() + if(my_int_fast32_t /= 3_c_int_fast32_t ) call abort() + + if(my_int64_t /= 1_c_int64_t) call abort() + if(my_int_least64_t /= 2_c_int_least64_t) call abort() + if(my_int_fast64_t /= 3_c_int_fast64_t ) call abort() + + if(my_intmax_t /= 1_c_intmax_t) call abort() + if(my_intptr_t /= 0_c_intptr_t) call abort() + + if(my_float /= 1.0_c_float) call abort() + if(my_double /= 2.0_c_double) call abort() + if(my_long_double /= 3.0_c_long_double) call abort() + + if(my_char /= c_char_'y') call abort() + if(my_bool .neqv. .true._c_bool) call abort() + end subroutine param_test + +end module c_kind_params +! { dg-final { cleanup-modules "c_kind_params" } } |