On Sun, Jun 17, 2007 at 01:03:03PM +0000, Debian Bug Tracking System wrote:
it seems to be a gcc optimisation bug in lisp_atan2()
(found in src/lisp.cpp)
compiling that file with -O0 instead of -O2 fixes it.
attached is a modified lisp_atan2() that gcc has no problems with.
(this one works OK if compiled with -02)
FWIW$ gcc --version
gcc (GCC) 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)
I've reporting the bug in gcc
Bye.
Jasen
long lisp_atan2(long dy, long dx)
{
if (dy==0)
{
if (dx>0) return 0;
else return 180;
} else if (dx==0)
{
if (dy>0) return 90;
else return 270;
} else
{
if (dx>0)
{
if (dy>0)
{
if ((dx)>(dy))
{
long a=dx*29/dy;
if (a>=TBS) return 0;
else return 45-atan_table[a];
}
else
{
long a=dy*29/dx;
if (a>=TBS) return 90;
else return 45+atan_table[a];
}
} else // dy < 0
{
if ((dx)>(-dy))
{
long a=dx*29/(-dy);
if (a>=TBS)
return 0;
else
return 315+atan_table[a];
}
else
{
long a=(-dy)*29/dx;
if (a>=TBS)
return 260;
else
return 315-atan_table[a];
}
}
} else // dx < 0
{
if (dy>0)
{
if ((-dx)>(dy))
{
long a=-dx*29/dy;
if (a>=TBS)
return 135+45;
else
return 135+atan_table[a];
}
else
{
long a=dy*29/-dx;
if (a>=TBS)
return 135-45;
else
return 135-atan_table[a];
} // dy < 0
} else
{
if ((-dx)>(-dy))
{
long a=-dx*29/(-dy);
if (a>=TBS)
return 225-45;
else return 225-atan_table[a];
}
else
{
long a=(-dy)*29/(-dx);
if (a>=TBS)
return 225+45;
else return 225+atan_table[a];
}
}
}
}
}