[PATCH,fortran] fix iso_c_binding only clause bug

Christopher D. Rickett crickett@lanl.gov
Thu Jul 5 22:43:00 GMT 2007



On Thu, 5 Jul 2007, Brooks Moses wrote:

> Christopher D. Rickett wrote:
>> hi Tobias,
>>> This is something which should be rejected for -std=f2003; it should be
>>> easy using "gfc_notify_std (GFC_STD_F2003, ..." I think one can allow it
>>> by default, but I don't mind always rejecting it.Note: using "call 
>>> foo("abcdef"//C_CHAR_NULL)" works with
>>> "character(len=0),dimension(*)" per F2003 standard, which is implemented
>>> in gfortran. Thus prohibiting it completely would also be ok.
>> 
>> i agree that this should be an error w/ -std=f2003, but having it error for 
>> std=gnu or by default seems harsh to me.  i know of at least one other 
>> compiler that allows it.  if acceptable, i'll add the std=f2003
>> check for the error.
>
> In particular, if we do allow other character lengths in bind(c) procedures, 
> what happens if we then try to call them from a C program? Do they actually 
> work correctly?  What if we have a length other than one and a character 
> _array_ -- what happens then?  What if it's an assumed-shape array?  What if 
> it's an assumed-shape array of assumed length?
>

you raise some good points and i think calling from C would definitely 
be a problem.  completely rejecting it now seems the only safe way to go.

Chris



More information about the Fortran mailing list