[Bug c/104948] When '&&' present in a comparison, a warning should be generated

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Mar 16 09:10:07 GMT 2022


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

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to dagelf from comment #3)
> Can you please give me an example of code with the generated machine code
> where it actually works as a logical AND? 
> 
> Because I've tried several versions, and under no circumstances did it
> function as a binary operator. 
> 
> The warning might be improved to state that `&&` is not logical AND.

int f(int *a, int *b)
{
    if (*a && *b)
      return 1;
    return 0;
}


More information about the Gcc-bugs mailing list