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

--- Comment #4 from Gustavo Hime <gustavo.hime at mpimet dot mpg.de> ---
Regarding this as a duplicate: on the one hand, it seems to be the same issue.
Whether the (any) warning is on by default or not is something that will always
be disputable, but the main issue is getting the compiler to detect this.

However, since the object code does not contain the dead part, and hence no
symbols are resolved at link-time, many of the potential problems remain, i.e.,
the code will still compile and link in spite of there being a function call to
a symbol that isn't defined.

Consider that if the programmer writes an interface statement, thus suppressing
the "undeclared" part of the "undefinedness" and therefore the justification
for a compile-time warning, there should still be a link-time error message for
an unresolved symbol, the absence of which can be very misleading. The warning
that code was eliminated (as unreachable) would compensate for that.

For the record, the C compiler warns of undeclared symbols by default.

Reply via email to