From ura@euro-bill.net  Mon Apr 21 04:10:21 2003
Return-Path: <ura@euro-bill.net>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id F0E0437B401
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 21 Apr 2003 04:10:21 -0700 (PDT)
Received: from server148.winterfire.com (server148.winterfire.com [207.44.200.19])
	by mx1.FreeBSD.org (Postfix) with SMTP id 10F9743FAF
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 21 Apr 2003 04:10:21 -0700 (PDT)
	(envelope-from ura@euro-bill.net)
Received: (qmail 14099 invoked from network); 21 Apr 2003 11:25:50 -0000
Received: from unused.nbi.com.ua (HELO sphinx.zzz) (80.78.41.228)
  by server148.winterfire.com with SMTP; 21 Apr 2003 11:25:50 -0000
Received: (qmail 92311 invoked by uid 1001); 21 Apr 2003 11:10:16 -0000
Message-Id: <20030421111016.92310.qmail@sphinx.zzz>
Date: 21 Apr 2003 11:10:16 -0000
From: ura@euro-bill.net
To: FreeBSD-gnats-submit@freebsd.org
Subject: gcc compiler bug with floating point
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         51210
>Category:       i386
>Synopsis:       gcc compiler bug with floating point
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Apr 21 04:20:15 PDT 2003
>Closed-Date:    Thu May 22 10:22:26 PDT 2003
>Last-Modified:  Thu May 22 10:22:26 PDT 2003
>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:

From: David Schultz <das@FreeBSD.ORG>
To: ura@euro-bill.net
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: i386/51210: gcc compiler bug with floating point
Date: Fri, 2 May 2003 04:42:57 -0700

 On Mon, Apr 21, 2003, ura@euro-bill.net wrote:
 > 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.
 
 gcc 3.2 is known broken in this regard.  It is more helpful if you
 can report this kind of problem to the gcc folks; we don't write
 the compiler.  BTW, does this still happen with a gcc 3.3 snapshot?

From: Mikhail Teterin <mi+mx@aldan.algebra.com>
To: freebsd-gnats-submit@FreeBSD.org, ura@euro-bill.net
Cc:  
Subject: Re: i386/51210: gcc compiler bug with floating point
Date: Mon, 12 May 2003 13:51:19 -0400

 This seems like a duplicate of PR bin/43299:
 
 	http://www.FreeBSD.org/cgi/query-pr.cgi?pr=bin/43299
 
 	-mi
 
 
State-Changed-From-To: open->closed 
State-Changed-By: anholt 
State-Changed-When: Thu May 22 10:20:38 PDT 2003 
State-Changed-Why:  
Duplicate of bin/43299 and a patch has been committed to bsd.cpu.mk to prevent 
-march=pentium4 from being added with p4 CPUTYPE. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=51210 
>Unformatted:
