retitle 524472 gcc-4.3: gcc 4.3.2 strict-aliasing bug / miscompiles GMP 4.3.0 thanks
I've tracked down the bug and managed to write a simple testcase: /* With GCC 4.3.2 and -O2 option: output value is 1 instead of 0. * If -fno-strict-aliasing is added, this bug disappears. */ #include <stdio.h> #include <stdlib.h> int test (int n) { unsigned long *p, *q; int i; q = p = malloc (n * sizeof (unsigned long)); if (p == NULL) return 2; for (i = 0; i < n - 1; i++) p[i] = 0; p[n - 1] = 1; while ((*(q++))-- == 0) ; return p[n - 1] == 1; } int main (void) { int r; r = test (17); printf ("%d\n", r); return r; } -- Vincent Lefèvre <vinc...@vinc17.org> - Web: <http://www.vinc17.org/> 100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/> Work: CR INRIA - computer arithmetic / Arenaire project (LIP, ENS-Lyon) -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org