This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
gcc-2.95.3.test4 miscompiles calc-2.11.4t2 on PowerPC
- To: gcc-bugs at gcc dot gnu dot org
- Subject: gcc-2.95.3.test4 miscompiles calc-2.11.4t2 on PowerPC
- From: Martin Buck <m at rtin-buck dot de>
- Date: Sat, 24 Feb 2001 02:43:03 +0100
- Cc: chongo at mellis dot com
gcc 2.95.3.test4 seems to miscompile calc-2.11.4t2 (an arbitrary precision
calculator with a really useful testsuite) on PowerPC. calc's testsuite
("make chk") fails, if calc's source file zfunc.c is compiled with -O2.
Going back to -O1 or turning off optimization completely fixes the problem.
I tracked down the problem to be in function zsqrt(), variable d. If you
make d volatile, the errors go away:
*** zfunc.c.orig Fri Feb 23 18:18:39 2001
--- zfunc.c Fri Feb 23 18:39:33 2001
***************
*** 1481,1487 ****
{
HALF *a, *A, *b, *a0, u;
int i, j, j1, j2, k, k1, m, m0, m1, n, n0, o;
! FULL d, e, f, g, h, s, t, x, topbit;
int remsign;
BOOL up, onebit;
ZVALUE sqrt;
--- 1481,1488 ----
{
HALF *a, *A, *b, *a0, u;
int i, j, j1, j2, k, k1, m, m0, m1, n, n0, o;
! volatile FULL d;
! FULL e, f, g, h, s, t, x, topbit;
int remsign;
BOOL up, onebit;
ZVALUE sqrt;
Sorry, but I could not reduce this to a simpler test case. zsqrt() is a bit
hard to grok for me.
I've seen this problem only on PowerPC, but it also happens with
gcc-2.95.2.
BTW, calc is at http://www.isthe.com/chongo/tech/comp/calc/
Thanks,
Martin
--
Martin Buck E-mail: m@rtin-buck.de or martin.buck@bigfoot.com
Phone/Fax: +41-56-4963841 Snail-mail: Steigstrasse 13, CH-5452 Oberrohrdorf
GPG key available WWW: http://home.pages.de/~mbuck/