linux-mips
[Top] [All Lists]

Re: another gcc optimization bug?

To: Zhang Fuxin <fxzhang@ict.ac.cn>
Subject: Re: another gcc optimization bug?
From: "H . J . Lu" <hjl@lucon.org>
Date: Tue, 5 Feb 2002 15:44:37 -0800
Cc: "linux-mips@oss.sgi.com" <linux-mips@oss.sgi.com>
In-reply-to: <200202051457.g15EvfA12401@oss.sgi.com>; from fxzhang@ict.ac.cn on Tue, Feb 05, 2002 at 10:54:42PM +0800
References: <200202051457.g15EvfA12401@oss.sgi.com>
Sender: owner-linux-mips@oss.sgi.com
User-agent: Mutt/1.2.5i
On Tue, Feb 05, 2002 at 10:54:42PM +0800, Zhang Fuxin wrote:
> hi,
>     It seems gcc with optimization > -O2 will produce incorrect code for fp 
> code:
> I find this example when tracking down the libm-test failures.
>   ( expf(NaN) == NaN will report an extra "invalid operation" exception )
> The faulting code snippet is:
>       float __my_expf(float x)                /* wrapper expf */
> {
>       float z;
>       unsigned int hx;
>       z = __ieee754_expf(x);
>       if(_LIB_VERSION == _IEEE_) return z;
>       if(__finitef(x)) {
>           if(x>o_threshold)
>               return 1.0;
>           else if(x<u_threshold)
>               return 2.0;
>             printf("haha\n");
>       } 
>       return z;
> }
> 
> with -O2(or higher),some statements inside "if (__finitef(x))" are put before
> testing the return value of __finitef(x),one of which is a c.lt.s that cause
> the extra "invalid operation" exception being raised.
> 

This bug seem fixed in gcc 3.1.


H.J.

<Prev in Thread] Current Thread [Next in Thread>