On 21/04/15 13:16, Marek Polacek wrote:
(-Wlogical-op still isn't enabled neither by -Wall nor by -Wextra.)
The reason is https://gcc.gnu.org/PR61534
which means we don't want to warn for:
extern int xxx;
#define XXX xxx
int test (void)
{
if (!XXX && xxx)
return 4;
else
return 0;
}
(gcc/testsuite/gcc.dg/pr40172-3.c, although it should be moved to c-c++-common)
As noted in the PR: The problem is that !XXX becomes XXX == 0, but it has the
location of "!", which is not virtual. If we look at the argument of the
expression, then XXX is actually a var_decl, whose location corresponds to the
declaration and not the use, and it is not virtual either. This is PR43486.
Bootstrapped/regtested on x86_64-linux, ok for trunk?
Does it pass bootstrap if you enable it? That is, is GCC itself -Wlogical-op
clean?
Cheers,
Manuel.