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

            Bug ID: 70361
           Summary: Obviously false code in if not detected
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dcb314 at hotmail dot com
  Target Milestone: ---

Derived from code in the Linux kernel, the following C++ source code produces
no warning with gcc trunk

extern void g(int);

void f( int n)
{
        if ((n & 0x02) == 1)
                g( n);
}

$ ~/gcc/results/bin/gcc -c -Wunreachable-code  -O2 -Wall -Wextra bug275.cc
$ ~/gcc/results/bin/gcc -v
Using built-in specs.
COLLECT_GCC=/home/dcb/gcc/results/bin/gcc
COLLECT_LTO_WRAPPER=/home/dcb/gcc/results/libexec/gcc/x86_64-pc-linux-gnu/6.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../src/trunk/configure --prefix=/home/dcb/gcc/results
--disable-bootstrap --disable-multilib --disable-werror --enable-checking=yes
--enable-languages=c,c++,fortran
Thread model: posix
gcc version 6.0.0 20160321 (experimental) (GCC) 
$

Reply via email to