This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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] fix iso_c_binding only clause bug


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.

IMO, it should at least provide a warning by default. I believe this is a case where we're not really adding any useful functionality, and thus mostly this proposed extension just gives users more rope with which to hang themselves when they try to port things.


I think it might also be useful to ask why this is done this way in the standard, before we allow it with -std=gnu. (I recall that there were discussions on comp.lang.fortran about it a few months back.)

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?

- Brooks


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