Date: 21 Apr 2003 11:10:16 -0000 From: ura@euro-bill.net To: FreeBSD-gnats-submit@FreeBSD.org Subject: i386/51210: gcc compiler bug with floating point Message-ID: <20030421111016.92310.qmail@sphinx.zzz> Resent-Message-ID: <200304211120.h3LBKFxv094803@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 51210
>Category: i386
>Synopsis: gcc compiler bug with floating point
>Confidential: no
>Severity: critical
>Priority: high
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Mon Apr 21 04:20:15 PDT 2003
>Closed-Date:
>Last-Modified:
>Originator:
>Release: FreeBSD 5.0-RELEASE-p7 i386
>Organization:
>Environment:
/etc/make.conf
CPUTYPE=p4
CFLAGS=-O2 -pipe
COPTFLAGS=-O2 -pipe
ttyp4 ~> gcc -v
Using built-in specs.
Configured with: FreeBSD/i386 system compiler
Thread model: posix
gcc version 3.2.1 [FreeBSD] 20021119 (release)
>Description:
When libm(msun) built with -march=pentium4, pow(3) returns incorrect
results.
>How-To-Repeat:
You must have pentium4 processor.
Compile whole system with specified /etc/make.conf (actually you
can compile only libm with this flags).
And try to compile this piece of code:
----[Cut]-----
#include <stdio.h>
#include <math.h>
int
main ()
{
double res = pow(0.001953125F, 2.2000000476837158F);
printf("%f", res);
}
----[Cut]-----
You will get 512.0000 (shoud be 0.000001)
>Fix:
I've found a workaround. Seems that gcc do not have such bug with
-march=pentium3. So if you replace
CPUTYPE=p4
to
CPUTYPE=p3
problem will be solved.
>Release-Note:
>Audit-Trail:
>Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030421111016.92310.qmail>
