This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/16502] inappropriate -Wunreachable-code warning from generic code
- From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 13 Jul 2004 04:21:12 -0000
- Subject: [Bug middle-end/16502] inappropriate -Wunreachable-code warning from generic code
- References: <20040712210704.16502.sebor@roguewave.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-07-13 04:21 -------
No it is not going to be fixed as -Wunreachable-code is documented to do this:
-Wunreachable-code
Warn if the compiler detects that code will never be executed.
This option is intended to warn when the compiler detects that at least a whole line of source code will
never be executed, because some condition is never satisfied or because it is after a procedure that
never returns.
It is possible for this option to produce a warning even though there are circumstances under which
part of the affected line can be executed, so care should be taken when removing apparently-
unreachable code.
For instance, when a function is inlined, a warning may mean that the line is unreachable in only one
inlined copy of the function.
This option is not made part of -Wall because in a debugging version of a program there is often
substantial code which checks correct functioning of the program and is, hopefully, unreachable
because the program does work. Another common use of unreachable code is to provide behavior
which is selectable at compile-time.
Inlining and templates are one in the same, cloning so this is not a bug still. You really should only
use this to find possible places which is unreachable and not to find every place. Function cloning is
what causes these to warn differently so this is still not a bug.
--
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |minor
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
Target Milestone|3.5.0 |---
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16502