http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59491

            Bug ID: 59491
           Summary: compiler can't detect if xpression is always fixed
                    value
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dcb314 at hotmail dot com

Given the following code 

void g( int n);

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

trunk gcc says not a lot

[dcb@zippy4 Alphasrc]$ ~/gcc/results/bin/gcc -g -O2 -Wall -c dec12b.cc
[dcb@zippy4 Alphasrc]$ ~/gcc/results/bin/gcc -g -O2 -Wall -Wextra -pedantic -c
dec12b.cc

Here is cppcheck being a bit more vocal about it 

[dcb@zippy4 Alphasrc]$ cppcheck --enable=all dec12b.cc
Checking dec12b.cc...
[dec12b.cc:6]: (style) Expression '(X & 0x8) == 0x1' is always false.

Reply via email to