https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80701
--- Comment #6 from Gustavo Hime <gustavo.hime at mpimet dot mpg.de> --- (In reply to Thomas Koenig from comment #5) Dear Thomas, Thank you for the feedback. Please keep in mind this can easily arise in a shared codebase, sometimes unintentionally. As Dominique pointed out, a similar issue is open in the GCC tracker as well. The example you wrote below is something I do as well, and is code instrumentation, which is not what I am pointing out as a source of problems. Cheers. > This one really depends on personal preference. > > Personally, I like adding statemens like > > parameter, logical :: debug = .false. > > ... > if (debug) then > call some_routine_for_debugging_stuff > end if > > Removing dead code including function calls is something that is done in the > middle-end. Here is an equivalent C test case: > > $ cat undef.c > void foo(void); > > int main() > { > if (0) > foo(); > return 0; > } > $ gcc -Wall -Wextra undef.c > $ > > I don't think we will get agreement to turn on such a warning > by default. However, a request for an option that warns in such > a case is justified. > > Confirming as enhancement request.