------- Comment #2 from rguenth at gcc dot gnu dot org 2008-08-13 09:16 ------- The C standard specifies that the comparison is done in type int which means that for both signed and unsigned char
(char)-1 != (unsigned short)-1 should evaluate to false. Testcase: extern void abort (void); void func_1 (unsigned short p_65) { signed char g_99 = -1; if (p_65 == g_99) abort (); } void func_2 (unsigned short p_65) { unsigned char g_99 = -1; if (p_65 == g_99) abort (); } int main (void) { func_1 (-1); func_2 (-1); return 0; } This looks like yet another folding bug as we end up with the comparison narrowed. -- rguenth at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |rguenth at gcc dot gnu dot | |org Status|UNCONFIRMED |NEW Component|c |middle-end Ever Confirmed|0 |1 Keywords| |wrong-code Known to fail| |4.3.1 4.4.0 Known to work| |4.2.4 Last reconfirmed|0000-00-00 00:00:00 |2008-08-13 09:16:17 date| | Summary|possible integer codegen bug|[4.3/4.4 Regression] | |possible integer codegen bug Target Milestone|--- |4.3.2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37103