------- Comment #2 from burnus at gcc dot gnu dot org 2010-08-17 09:34 ------- (In reply to comment #0) > shouldn't: > call bar (i) > call bar (f) > warn not just about the argument mismatch to foo, but also about bar?
Yes. One should construct the function interface from the argument usage - and then warn if does not match. Cf. PR 44471. > Is there any way to differentiate between the two cases (when we know the > subroutine/function has no arguments and is defined in the current TU, or > when it is unknown)? Well, if the interface is known, one can check attr.ifsrc != IFSRC_UNKNOWN - but I think that's not what you are looking for. For the TU, one can try to find the global symbol via if (gfc_option.flag_whole_file) { gfc_gsymbol *gsym; gsym = gfc_find_gsymbol (gfc_gsym_root, sym->name); if (gsym) { .... } Though one needs to be careful if the symbol is an ENTRY and not a real subroutine, cf. gfc_get_extern_function_decl -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45304