On Monday 12 November 2007 12:33:41 Andy Dougherty wrote:
> I was trying parrot for the first time in a while today, and the test
> suite hung at t/op/arithmetics_22.pasm. (This is with gcc-4.1.0 on
> Solaris 8/SPARC.) It just sits and uses up CPU. It appears to be stuck
> in the 'gcd' op.
>
> It's been a while since I tried compiling with gcc, so I don't know how
> long this problem has been here.
>
> After poking around quite a bit, the following patch fixes it:
>
> --- parrot-current/src/ops/experimental.ops Wed Oct 17 19:15:15 2007
> +++ parrot-andy/src/ops/experimental.ops Mon Nov 12 15:13:43 2007
> @@ -91,7 +91,7 @@
> FLOATVAL temp2 = fabs($2);
> FLOATVAL temp3 = fabs($3);
>
> - while (!FLOAT_IS_ZERO(temp3)) {
> + while (temp3 != 0.0) {
> q = floor((FLOATVAL)temp2/temp3);
> c = temp2 - temp3*q;
> temp2 = temp3;
>
> It may well be there's an issue with gcc's optimizer, since the problem
> goes away without optimization, but I think it's also fair to say that
> the definition of FLOAT_IS_ZERO in include/parrot/misc.h is
> perhaps not optimal here. I'd prefer the simpler definition:
>
> #define FLOAT_IS_ZER0(f) ((f) == 0.0)
>
> but I didn't get anywhere last time I proposed that. I don't know
> what else to do.
For what it's worth (as the person who had to distill the existing abominable
macro definition and try to get it working portably), I now agree with Andy
here.
If no one beats me to applying this patch in the next several hours, I'll do
it myself.
-- c