The following code-snippest generate wrong numbers with gcc 4.1.1 using -O, -O1 and -O2. #include <stdio.h> int main(int arg, char *argv[]) { int j; for (j=0; j<256; j++) { signed char j2=(signed char)j; printf("%d\n", (signed int)j2); } return 0; } http://bugs.gentoo.org/show_bug.cgi?id=154079
This is fixed already.
But no releases that fixes this issue has been released in the 4.1.x serie as far as I can see atleast.
*** This bug has been marked as a duplicate of 27639 ***