ISO_C_BINDING patch commited to fortran-experiments branch

Tobias Burnus burnus@net-b.de
Mon Dec 18 17:51:00 GMT 2006


Hi,

Tobias Burnus wrote:
> FAIL: gfortran.dg/bind_c_coms.f90  -O0  (test for excess errors)
>   
The problem is that one cannot use:

   real(c_double) :: r

this gives the error:

  C kind param 'c_double' at (1) not valid for REAL

The reason is: In iso-c-binding.def, one uses NAMED_INTCST for
everything, e.g.

NAMED_INTCST (ISOCBINDING_INT, "c_int", gfc_c_int_kind)
NAMED_INTCST (ISOCBINDING_FLOAT, "c_float", \
              get_real_kind_from_node (float_type_node))
NAMED_INTCST (ISOCBINDING_DOUBLE_COMPLEX, "c_double_complex", \
              get_real_kind_from_node (double_type_node))
NAMED_INTCST (ISOCBINDING_CHAR, "c_char", gfc_default_character_kind)

Attached patch fixes this. Is this the right approach?


In any case, it then regtests fine on x86_64-unknown-linux-gnu, except for:

* gfortran.dg/c_kind_params.f90:
    integer(c_int_fast8_t), value :: my_int_fast8_t
                        1
Error: Kind -2 not supported for type INTEGER at (1)

Which is expected, but I think it should be supported as well,
at least when /usr/include/stdint.h provides them.

NAMED_INTCST (ISOCBINDING_INT_FAST8_T, "c_int_fast8_t", -2)
NAMED_INTCST (ISOCBINDING_INT_FAST16_T, "c_int_fast16_t", -2)
NAMED_INTCST (ISOCBINDING_INT_FAST32_T, "c_int_fast32_t", -2)
NAMED_INTCST (ISOCBINDING_INT_FAST64_T, "c_int_fast64_t", -2)

Tobias
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bind-c-kind.diff
Type: text/x-patch
Size: 6234 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20061218/6ed28e82/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bind-c-testsuite.diff
Type: text/x-patch
Size: 940 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20061218/6ed28e82/attachment-0001.bin>


More information about the Fortran mailing list