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 other/38370] New: inconsistent warnings


[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;
}


-- 
           Summary: inconsistent warnings
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: other
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: doko at ubuntu dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38370


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