https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80701

--- Comment #2 from Gustavo Hime <gustavo.hime at mpimet dot mpg.de> ---
--- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
> The compiler does generate a warning about the implicit interface if
> -Wimplicit-interface is turned on explicitly. I would suggest this should
> be on by default with -Wall on any source not written in F77,

>How do you know it before hand? 

Know what?  The compiler can identify the minimum standard required from the
features used. In any event this is only part of the problem I reported.

>In addition I don't think the warning is
>relevant: if I add an interface, the warning disappears (as it should), but
>there is still no mention of the "undefined" symbol that is used in the code.

You can only add the interface if you know beforehand that the function is not
defined in any e.g. include or use statement. This implies you have written the
code yourself, and did so quite carefully, or that you work in an environment
where you can expect others to do the same.

Maybe you don't quite visualize the potential problems. Try looking at the
following:
MODULE P
  LOGICAL, PARAMETER :: condition = .true.
END MODULE P

MODULE M
  PUBLIC :: f
CONTAINS
  SUBROUTINE f
    USE P
    IF (condition) RETURN
    CALL undefined
  END SUBROUTINE f
END MODULE M

... here, the compiler knows the condition is always true, but this might
easily be overseen by the programmer in a large codebase, who would be
justified in assuming that module P defines both "condition" and "undefined".
Alternatively, if the return statement is in the middle of a large (dirty and
ugly) routine, you might find yourself wondering (as I did) how come your code
compiles AND LINKS when you know the function "undefined" is not to be found in
the objects being linked together, without any warnings.

> or when a higher standard is enforced.

>IMO this should be closed as WONTFIX.

If you believe such code should compile and link cleanly, then keep it as is.

--
You are receiving this mail because:
You reported the bug.

Reply via email to