The following test demonstrates an incorrect sign in the following division :
#include <stdio.h> int main (void) { volatile long int n; n = -2; printf ("%ld\n", (-2147483647L - 1L) / (-n)); return 0; } I get a correct result with 4.0.3, and a wrong sign with snapshots 20060325 and 20060408. Also reported in debian : http://bugs.debian.org/361883 -- Summary: Incorrect integer division (wrong sign). Product: gcc Version: 4.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: laurent at komite dot net http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27116