386/ix bug on doubles inside if-statement ?

Jon Zeeff zeeff at b-tech.UUCP
Thu Apr 28 07:58:38 AEST 1988


In article <672 at altger.UUCP> dirk at altger.UUCP (dirk) writes:
>Does anyboady have an idea why the following program fails ?
>
>	if (fabs (a) < fabs (b)) printf("a is lower\n"); 

Evidently most of the Sys V '386 compilers produce incorrect code for this.

Often you get:

	fldl	-40(%ebp)
	fcompp

When you should get:

	fcompl	-40(%ebp)

Perhaps the bug is consistent enough that the first form can always be 
replaced by the second form by some add on program.

Does anyone have gcc working well enough that I can throw out this buggy
compiler?

-- 
Jon Zeeff           		Branch Technology,
uunet!umix!b-tech!zeeff  	zeeff%b-tech.uucp at umix.cc.umich.edu



More information about the Comp.unix.microport mailing list