[Patch, Fortran] PR40276/PR57711 - improve generic diagnostic
Tobias Burnus
burnus@net-b.de
Wed Jun 26 07:48:00 GMT 2013
This patch attempts to improve the diagnostic for generic matches, if a
dummy procedure is used which has nonmatching characteristics.
Before the patch:
call gen(sub)
1
Error: There is no specific subroutine for the generic 'gen' at (1)
After the patch:
call gen(sub)
1
Error: Interface mismatch in dummy procedure 'a' at (1): INTENT mismatch
in argument 'x'
The idea is that if the argument is a procedure* in generic resolution,
there cannot be nonambiguous specific where the characters match. Thus,
we first claim that there is a generic match - and later (after all
arguments match) re-check whether the characteristics of the
actual/dummy procedures are indeed the same.
Build and regtested on x86-64-gnu-linux.
OK for the trunk?
Tobias
* For completness: In F2008, one can distinguish a subroutine from a
function; I think that's not yet implemented and but it shouldn't affect
this patch, either.
PS: I think there could be some additional cases, which should be
handled likewise (e.g. pureness, pointer/allocatable attribute etc.) -
but I haven't thought about those. - PR57711 additionally shows that the
interface mismatch is not detected when directly invoking the specific
procedure and not using the generic one.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: generic-diagnostic.diff
Type: text/x-patch
Size: 6390 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20130626/58f4eefa/attachment.bin>
More information about the Fortran
mailing list