This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


>>> 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]