GCC 4.3.2 bug (was: Illegal subtraction in tmp-dive_1.s)
Vincent Lefevre
vincent at vinc17.org
Fri Apr 17 17:05:32 CEST 2009
I've looked at tree output of mpn/generic/rootrem.c and differences
between gcc 4.3.1 (where the bug doesn't occur) and gcc 4.3.2 (as
gcc 4.3.3 isn't installed on the machine).
To avoid spurious differences, I had to replace
#include <stdio.h> /* for NULL */
by
#define NULL ((void *)0)
I could check that the bug is still triggered in gcc 4.3.2.
The first differences are in the rootrem.c.052t.salias file (there
are many differences). Then the next difference:
diff -aurd 431/rootrem.c.058t.fre 432/rootrem.c.058t.fre
--- 431/rootrem.c.058t.fre 2009-04-17 15:01:26.000000000 +0200
+++ 432/rootrem.c.058t.fre 2009-04-17 15:01:45.000000000 +0200
@@ -979,7 +979,7 @@
D.4421_328 = D.4421_316;
D.4422_329 = D.4422_317;
D.4423_330 = D.4423_318;
- D.4424_331 = *D.4423_330;
+ D.4424_331 = D.4399_260;
D.4432_332 = D.4424_331 == 0;
qn_333 = qn_310 - D.4432_332;
This corresponds to the line 322:
318 qn = b / GMP_NUMB_BITS + 1; /* b+1 bits */
319 MPN_ZERO (qp, qn);
320 qp[qn - 1] = (mp_limb_t) 1 << (b % GMP_NUMB_BITS);
321 MPN_DECR_U (qp, qn, 1);
322 qn -= qp[qn - 1] == 0;
D.4399_260 is the value of (mp_limb_t) 1 << (b % GMP_NUMB_BITS).
So, I assume that gcc thinks that qp[qn - 1] hasn't been modified
by MPN_DECR_U.
MPN_DECR_U contains:
mp_ptr __p = (qp);
Then __p[...] is modified.
Concerning D.4423_330, there's a change in rootrem.c.052t.salias,
but I don't know what it means:
-D.4423_330 = qp_75
+D.4423_330 = ANYTHING
The problem in rootrem.c.058t.fre disappears with the option
-fno-strict-aliasing.
The problem also disappears if I remove __attribute__ ((malloc))
on the __gmp_tmp_reentrant_alloc declaration.
--
Vincent Lefèvre <vincent at 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)
More information about the gmp-discuss
mailing list