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/77292] value range propagation (VRP) would improve -Wlogical-not-parentheses


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

--- Comment #6 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
(In reply to Manuel López-Ibáñez from comment #4)
> Note that Clang suggests two ways to silence the warning:
> 
> prog.cc:9:10: note: add parentheses after the '!' to evaluate the comparison
> first
>   return !a == b;
>          ^
>           (     )
> prog.cc:9:10: note: add parentheses around left hand side expression to
> silence this warning
>   return !a == b;
>          ^
>          ( )

I guess I should employ here the fix-it feature we now have...

> Also, we do not warn for actual booleans (bool).

This is intentional.

> To be able to not warn based on the runtime range of variables, we would
> need something like VRP in the FE, and that is unlikely to be implemented in
> the medium future.

...if ever.

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