This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
optimization/576: gcc performs invalid optimization with float operations.
- To: gcc-gnats at gcc dot gnu dot org
- Subject: optimization/576: gcc performs invalid optimization with float operations.
- From: goualard at cwi dot nl
- Date: 28 Sep 2000 13:49:19 -0000
- Reply-To: goualard at cwi dot nl
- Resent-Cc: gcc-prs at gcc dot gnu dot org, gcc-bugs at gcc dot gnu dot org
- Resent-Reply-To: gcc-gnats@gcc.gnu.org, goualard@cwi.nl
>Number: 576
>Category: optimization
>Synopsis: gcc performs invalid optimization with float operations.
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: wrong-code
>Submitter-Id: net
>Arrival-Date: Thu Sep 28 06:56:01 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator: Frederic Goualard
>Release: gcc version 2.95.2 19991024 (release)
>Organization:
>Environment:
Red Hat Linux release 6.2 (Zoot)
Kernel 2.2.14-12 on an i686
Environment variables have their default values under this
O.S.
>Description:
gcc performs optimizations that are invalid for some
floating-point computations when the rounding direction
is set towards +infinity or -infinity. As shown in
the code example, trivial identities do no longer hold.
>How-To-Repeat:
#include <stdio.h>
const double MAXDOUBLE=1.797693134862315708e+308;
static unsigned int _up = 0x1a3f;
inline void
roundUpward()
{
asm ("fldcw _up");
}
int
main()
{
roundUpward();
double a=MAXDOUBLE;
double b=(-a)*a;
printf("%g %g\n",(-a)*a, b);
printf("%g %g\n", -((-a)*a), -b);
}
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: