------- Comment #7 from kazu at gcc dot gnu dot org 2006-01-15 21:44 ------- In the original test case, TRUNC_DIV_EXPR is used, but we can also use TRUNC_MOD_EXPR to cause a similar problem. See below.
#include <stdio.h> signed char a = -4; #if 0 #define CALC(A) (((unsigned int) (signed int) (A)) / 2LL) #else #define CALC(A) (((unsigned int) (signed int) (A)) % 5LL) #endif int test () { return CALC (a); } int main (void) { int r; r = test (); printf ("test output: %#x == %d %x %x\n", r, r, (r == 0x7ffffffe), (r == 0xfffffffe)); if (r == CALC ((signed char) -4)) printf ("test successful\n"); else printf ("test failed\n"); return 0; } -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19606