public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/111056] New: Missing -Wsign-compare warning with enum values
@ 2023-08-17 22:16 alexhenrie24 at gmail dot com
  2023-08-17 22:42 ` [Bug c/111056] " pinskia at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: alexhenrie24 at gmail dot com @ 2023-08-17 22:16 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 111056
           Summary: Missing -Wsign-compare warning with enum values
           Product: gcc
           Version: 13.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: alexhenrie24 at gmail dot com
  Target Milestone: ---

#include <stdio.h>

int main()
{
    signed int a = 1;
    enum : signed int { b = 1 };
    unsigned int c = -1;

    if (a < c) // condition is true, -Wsign-compare warns about it
        puts("a < c");

    if (b < c) // condition is true, but no warning
        puts("b < c");

    return 0;
}

The compiler should warn about both if statements.

$ gcc --version
gcc (GCC) 13.2.1 20230801

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

end of thread, other threads:[~2023-08-18  0:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-17 22:16 [Bug c/111056] New: Missing -Wsign-compare warning with enum values alexhenrie24 at gmail dot com
2023-08-17 22:42 ` [Bug c/111056] " pinskia at gcc dot gnu.org
2023-08-17 23:11 ` alexhenrie24 at gmail dot com
2023-08-18  0:50 ` alexhenrie24 at gmail dot com
2023-08-18  0:55 ` 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).