https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84591
kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kargl at gcc dot gnu.org

--- Comment #2 from kargl at gcc dot gnu.org ---
(In reply to Dominique d'Humieres from comment #0)
> Compiling gfortran.dg/bind_c_usage_10.f03 with -fdefault-integer-8 gives
> errors:
> 
> /opt/gcc/_clean/gcc/testsuite/gfortran.dg/bind_c_usage_10.f03:66:31:
> 
>    integer(c_int) function func4()
>                                1
> Error: FUNCTION result func4 can't be of type INTEGER(4) in FUNCTION func4
> at (1)
> /opt/gcc/_clean/gcc/testsuite/gfortran.dg/bind_c_usage_10.f03:59:31:
> 
>    integer(c_int) function func3() bind(c, name="myFunc3")
>                                1
> Error: FUNCTION result func3 can't be of type INTEGER(4) in FUNCTION func3
> at (1)
> /opt/gcc/_clean/gcc/testsuite/gfortran.dg/bind_c_usage_10.f03:52:31:
> 
>    integer(c_int) function func2()
>                                1
> Error: FUNCTION result func2 can't be of type INTEGER(4) in FUNCTION func2
> at (1)
> /opt/gcc/_clean/gcc/testsuite/gfortran.dg/bind_c_usage_10.f03:45:31:
> 
>    integer(c_int) function func1() bind(c, name="myFunc1")
>                                1
> Error: FUNCTION result func1 can't be of type INTEGER(4) in FUNCTION func1
> at (1)
> 
> (1) I don't understand why there are these errors.

iso-c-binding.def, lines 50-56,

/* The arguments to NAMED_*CST are:
     -- an internal name
     -- the symbol name in the module, as seen by Fortran code
     -- the value it has, for use in trans-types.c  
     -- the standard that supports this type  */

NAMED_INTCST (ISOCBINDING_INT, "c_int", gfc_c_int_kind, GFC_STD_F2003)

trans-types.c lines 687-688

  /* Pick a kind the same size as the C "int" type.  */
  gfc_c_int_kind = INT_TYPE_SIZE / 8;

That is, gfc_c_int_kind is associated with C's int.  It is not
associated with gfc_default_integer_kind.


> (2) I didn't find a way to silence them.

You can silence them by removing the -fdefault-integer-8 option.

Reply via email to