This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/82100] gcc does not warn about code that is unreachable due to conflicting conditions [subset of reviving -Wunreachable-code]


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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]