[Patch, Fortran, F08] PR 44649: STORAGE_SIZE intrinsic

Janus Weil janus@gcc.gnu.org
Thu Jul 8 13:53:00 GMT 2010


>>> For C_SIZEOF: That's a Fortran 2008 function with "X shall be an
>>> interoperable data entity that is not an assumed-size array." - thus at
>>> least with -std=f2008 one should reject polymorphic arguments (better:
>>> non-BIND(C) derived types). For that one probably just needs to add
>>> expr_type == VARIABLE and using something like:
>>>          if (verify_c_interop (arg_ts) == SUCCESS
>>>              || gfc_check_any_c_kind (arg_ts) == SUCCESS)
>>>
>> Good point. I think "verify_c_interop" is sufficient.
>>
>
> +  if (arg->expr_type == EXPR_VARIABLE && verify_c_interop (&arg->ts) != SUCCESS)
>
>
> I think one can remove the expr_type check; e.g, one also wants to have
> interoperability of function results.
>
> I am also  wondering about EXPR_NULL; I think Fortran 2008 (though not
> yet gfortran) allows passing NULL for absent optional arguments and the
> TR will allow passing NULL for absent, optional arguments of C
> interoperable procedures.
>
> Thus, how about:
> if  (expr_type != EXPR_NULL && verify_c_interop (&arg->ts) != SUCCESS)

However, the argument of C_SIZEOF is not optional. So the check for
EXPR_NULL should not be necessary, right?

If so, we're down to a simple

if  (verify_c_interop (&arg->ts) != SUCCESS)


Cheers,
Janus



More information about the Gcc-patches mailing list