[Patch, Fortran] PR 47023: C_Sizeof: Rejects valid code
Janus Weil
janus@gcc.gnu.org
Tue Oct 18 11:57:00 GMT 2011
>> here is another patch for PR47023, which takes care of comment #1,
>> i.e. rejecting polymorphic variables in a C-binding context.
>>
>> Regtested on x86_64-unknown-linux-gnu. Ok for trunk?
>
> OK. Thanks for the patch.
Thanks. Committed as r180130.
> If I saw it correctly, one still needs to fix the vendor-extension SIZEOF
> for procedure pointers (it currently returns one byte!)
Right. Actually I don't quite understand where that 1 byte comes from. Example:
use iso_c_binding
procedure(real), pointer :: pp
pp => sin
print *,sizeof(pp)
print *,sizeof(pp(0.))
end
This spits out:
1
4
The second one is correct (giving the pointee size). The first one
should probably give the pointer size, but "1" is neither the size of
the pointer nor the pointee.
> and the issue in the original bug (comment 0).
Yes. I think that's it.
Cheers,
Janus
>> 2011-10-17 Janus Weil<janus@gcc.gnu.org>
>>
>> PR fortran/47023
>> * decl.c (verify_c_interop_param): Renamed to
>> 'gfc_verify_c_interop_param'. Add error message for polymorphic
>> arguments.
>> (verify_c_interop): Renamed to 'gfc_verify_c_interop'. Reject
>> polymorphic variables.
>> (verify_bind_c_sym): Renamed 'verify_c_interop'.
>> * gfortran.h (verify_c_interop,verify_c_interop_param): Renamed.
>> * check.c (gfc_check_sizeof): Ditto.
>> * resolve.c (gfc_iso_c_func_interface,resolve_fl_procedure): Ditto.
>> * symbol.c (verify_bind_c_derived_type): Ditto.
>>
>>
>> 2011-10-17 Janus Weil<janus@gcc.gnu.org>
>>
>> PR fortran/47023
>> * gfortran.dg/iso_c_binding_class.f03: New.
>
>
More information about the Gcc-patches
mailing list