public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/105581] New: boolean types and relational operators problem
@ 2022-05-12 10:11 dcb314 at hotmail dot com
  2022-05-12 10:23 ` [Bug c/105581] " pinskia at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: dcb314 at hotmail dot com @ 2022-05-12 10:11 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 105581
           Summary: boolean types and relational operators problem
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dcb314 at hotmail dot com
  Target Milestone: ---

For this C code:

void g( int );

void f( bool a, bool b)
{
        if (a < b)
                g( 1);
}

recent gcc doesn't find a problem:

$ /home/dcb/gcc/results/bin/gcc -c -g -O2 -Wall -Wextra -pedantic may12a.cc
$

Here is cppcheck complaining:

$ /home/dcb/cppcheck/trunk.git/cppcheck --enable=all may12a.cc
may12a.cc:6:8: style: Comparison of a variable having boolean value using
relational (<, >, <= or >=) operator. [comparisonOfBoolWithBoolError]
 if (a < b)
       ^
$

There is an example in the gcc source code:

trunk.git/gcc/sreal.h:72:25: style: Comparison of a variable having boolean
value using relational (<, >, <= or >=) operator.
[comparisonOfBoolWithBoolError]

Source code is

        return negative > other_negative;

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-10-27  6:45 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-12 10:11 [Bug c/105581] New: boolean types and relational operators problem dcb314 at hotmail dot com
2022-05-12 10:23 ` [Bug c/105581] " pinskia at gcc dot gnu.org
2022-05-12 10:46 ` schwab@linux-m68k.org
2022-05-12 11:49 ` dcb314 at hotmail dot com
2022-05-12 12:12 ` schwab@linux-m68k.org
2022-10-27  6:45 ` [Bug c/105581] new warning about boolean types and relational operators pinskia at gcc dot gnu.org
2022-10-27  6:45 ` pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).