------- Comment #1 from rguenth at gcc dot gnu dot org 2008-12-01 10:01 ------- /* Warn if two unsigned values are being compared in a size larger than their original size, and one (and only one) is the result of a `~' operator. This comparison will always fail.
Also warn if one operand is a constant, and the constant does not have all bits set that are set in the ~ operand when it is extended. */ note that integer promotion is done on the operand(!) of ~. So u1 == (u8_t)(~u2) is equal to (int)u1 == (int)(u8_t)(~(int)u2) that we do not warn for the first case is because it is optimized to u1 == ~u2 before. Why do you think the warning is incorrect? -- rguenth at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |diagnostic http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38341