Janus Weil wrote:
Ok, here is an updated patch, which does the discussed checking for
procedure pointer assignments. For this I have introduced a new
function 'gfc_explicit_interface_required', which checks all the items
in F08:12.4.2.2 and is loosely based on the present checks in
'resolve_global_procedure' (which are replaced by the new function).

I hope the general idea of the patch is ok and the error messages are
sufficiently comprehensible.

Thanks for working on it. It looks mostly okay.

+         snprintf (errmsg, err_len, "allocatable argument");
+         return true;


You should use "strncpy" instead of "snprintf". (Unless, you want to append ' "%s", 
arg->sym->name'; however, in this context, the argument name does not really matter.) Additionally, please use 
_("...") to mark it for translation.


(I was thinking whether it misses BT_CLASS function results, but the check 
res->attr.pointer should be always true for (both allocatable or pointer) 
polymorphic types.


(I don't really like the wording, but I cannot come up with something better; 
especially not if it should remain translatable. With the patch one has:

Explicit interface required for 'sub' at (1): allocatable argument
Explicit interface required for 'sub' at (1): pointer or allocatable result
Explicit interface required for 'sub' at (1): pointer or allocatable result
Explicit interface required for 'sub' at (1): elemental procedure )


One leftover problem: The patch currently fails on the auto_char_len_4
test case

The patch is okay with the strncpy/_("...") issues fixed.

Regarding auto_char_len_4.f90: As written in previous email, I think we should add a diagnostic for the external declaration ("EXTERNAL, CHARACTER(len=<nonconst>", "PROCEDURE(CHARACTER(len=<nonconst>)" (also proc-pointer) in resolve_symbol.

I think the best way forward would be to change the declarations to use "len=n", add a dumy argument and adapt the call. For the follow-up patch, one can then create a new test case.

Tobias

Reply via email to