This is the mail archive of the 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]

Re: [C/C++ PATCH] Improve -Wlogical-op (PR c/63357)

On Tue, Apr 21, 2015 at 04:19:26PM +0200, Manuel López-Ibáñez wrote:
> On 21/04/15 13:16, Marek Polacek wrote:
> >(-Wlogical-op still isn't enabled neither by -Wall nor by -Wextra.)
> The reason is
> 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?

No, there are many issues e.g. in config/i386/ exactly because of PR61534,
that is, with this patch, we warn even for

int var;
#define TARGET_64BIT var
main ()
    return 1;

So the bug really must be solved first :(.  I see I proposed a solution in the
PR, I wonder whether that works...


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