Bug 38370 - inconsistent warnings
Summary: inconsistent warnings
Status: RESOLVED DUPLICATE of bug 38341
Alias: None
Product: gcc
Classification: Unclassified
Component: other (show other bugs)
Version: 4.4.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-12-02 10:24 UTC by Matthias Klose
Modified: 2008-12-02 12:12 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Matthias Klose 2008-12-02 10:24:35 UTC
[forwarded from https://launchpad.net/bugs/291780]

When compiling a small test program, the compiler shows a warning I would either not expect at all, or expect it to appear for all four if-statements used in my example:

$ gcc -Wextra -c promotion.c
promotion.c: In function ‘main’:
promotion.c:10: warning: comparison of promoted ~unsigned with unsigned

promotion.c:
typedef unsigned char uint8_t;

int main(void)
{
        uint8_t a = 0;
        uint8_t b = 0;
        unsigned char c = 0;
        unsigned char d = 0;

        if (a == (b ^ 0xff)) { }
        if (a == (d ^ 0xff)) { }
        if (c == (b ^ 0xff)) { }
        if (c == (d ^ 0xff)) { }

        return 0;
}
Comment 1 Richard Biener 2008-12-02 12:12:03 UTC

*** This bug has been marked as a duplicate of 38341 ***