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] Spurious "warning: logical not is only applied to the left hand side of comparison"


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

--- Comment #3 from M Welinder <terra at gnome dot org> ---
The actual code I got this warning from was...

                if (!lower_tail == (p > phalf)) {

where lower_tail is an int and p and phalf are doubles.

That's simply a comparison of two booleans.  Note, that the hinted-at code

   !(lower_tail == (p > phalf))

is dubious: comparing an int to a booleans.

> this isn't visible to the compiler when it analyzes
>   return !a == b;

I am not aware of a rule that requires the compiler to ignore context
when considering warnings.  It certainly does consider context when
it issues "might be used uninitialized" warnings, so why not here?

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