This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/82100] gcc does not warn about code that is unreachable due to conflicting conditions [subset of reviving -Wunreachable-code]
- From: "dcb314 at hotmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 10 Apr 2018 08:36:51 +0000
- Subject: [Bug c/82100] gcc does not warn about code that is unreachable due to conflicting conditions [subset of reviving -Wunreachable-code]
- Auto-submitted: auto-generated
- References: <bug-82100-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82100
--- Comment #4 from David Binderman <dcb314 at hotmail dot com> ---
For this code:
extern void g( int, int);
extern void h( int, int);
void f( int i, int j)
{
if (i < j)
{
if (i < j)
g( 0, 0);
else
h( 1, 1);
}
}
gcc has little to say:
$ ~/gcc/results/bin/gcc -c -O2 -Wall -Wextra -Wunreachable-code -pedantic
apr10a.cc
$
I think there are about a dozen cases in the gcc source code where this
kind of identical inner condition occurs.
So the removal of the implementation of -Wunreachable-code seems
to allowed some not quite right code to appear in gcc itself.