Hi Steve,

On 1/22/20 4:54 PM, Steve Kargl wrote:
Supposedly, one can use attr.is_c_interop and attr.is_iso_c to determine if something is interoperable (if it is consistently set) and if it is from the ISO C Binding module.

I think this is fixable on two sides:

* For the used tree type, one just has to check kind value (the integer) plus whether the dummy's procedure is BIND(C). Here the problem is that we do not always have this information available (i.e. it needs to be passed on). Not difficult, but one needs to find all spots and think of how to pass the information.

* For the diagnostic, we can check whether the dummy argument is in bind(C) and do some additional diagnostic in this case (e.g. always warn for kind=4 with BIND(C) – or reject it unconditionally or with -std=... or …).

* The other issue related to kind=4: Fortran permits to pass a too long string as actual argument; but this is only permitted in the standard for kind=1 and kind=c_char strings. In gfortran, this also works fine with kind=4 – but one might still want to warn (with some -Wall or -std=f... or ...). Likewise, the trimming happening in this case might indicate a bug in the program: "Hello World" as actual to character(len=10) is most likely a bug, even if this is valid Fortran.

Cheers,

Tobias

Reply via email to