[PATCH, fortran] Interoperability with C int128_t types

FX Coudert fxcoudert@gmail.com
Tue Apr 1 11:08:00 GMT 2008


> Index: gcc/gcc/fortran/iso-c-binding.def
> +       /* c_int128_t, c_int_least128_t and c_int_fast128_t are gnu
> extensions.  */
> +       if (gfc_notification_std (GFC_STD_GNU) == FAILURE
> +           && (s == ISOCBINDING_INT128_T || s ==
> ISOCBINDING_INT_LEAST128_T
> +               || s == ISOCBINDING_INT_FAST128_T))
> +         break;

I'd prefer adding a new argument named "standard" to the NAMED_INTCST  
macro, which says what standard the named constant conforms to. It  
would be GFC_STD_F2003 for all current intrinsics, and GFC_STD_GNU  
for your extensions. It would then be checked against exactly as you  
do it currently.

> Index: gcc/gcc/testsuite/gfortran.dg/c_kind_int128_test2.f03
> ===================================================================
> --- /dev/null
> +++ gcc/gcc/testsuite/gfortran.dg/c_kind_int128_test2.f03
> @@ -0,0 +1,12 @@
> +! { dg-do compile }
> +! { dg-options "-std=gnu" }
> +!
> +! Note: int_fast*_t currently not supported.
> +
> +subroutine c_kind_params
> +  use, intrinsic :: iso_c_binding
> +  integer(c_int128_t) :: a
> +  integer(c_int_least128_t) :: b
> +! integer(c_int_fast128_t) :: c
> +
> +end subroutine c_kind_params

You should add explicit checks about the size of these variables, for  
example using SIZEOF() or other inquiry intrinsics. Also, what  
happens on platforms that don't have a 128-bit integer type?

You also need to add that extension in our texinfo documentation.  
Finally, when asking for approval, you should say what testing has  
been done and on which target(s). (For example, "bootstrapped and  
regtested on x86_64-linux").

Thanks,
FX


-- 
François-Xavier Coudert
http://www.homepages.ucl.ac.uk/~uccafco/



More information about the Fortran mailing list