This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

c/1610: multiplication bug in Intel PII + linux + gcc



>Number:         1610
>Category:       c
>Synopsis:       multiplication bug in Intel PII + linux + gcc
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Jan 10 12:46:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Soren Ragsdale
>Release:        gcc version 2.95.2 19991024 (release)
>Organization:
>Environment:

>Description:
The following code ought to produce two identical lines of
output, but the numbers differ.  (Important: compile WITHOUT
optimizations.)

/***************************************/
#include <stdio.h>

int main()
{
  float v1 = 0.99996075;
  float v2 = -966133.312501;
  float tmp;

  printf("%f\n",v1 * v2);

  tmp = v1 * v2;
  printf("%f\n",tmp);
}
/***************************************/

[1:41:22pm]fivefifty:/usr/people/soren/ 43> gcc/bin/gcc /d/bach/2soren.C 
[1:41:29pm]fivefifty:/usr/people/soren/ 44> ./a.out 
-966095.363304
-966095.375000
[1:41:31pm]fivefifty:/usr/people/soren/ 45> gcc/bin/gcc -v 
Reading specs from /usr/people/soren/gcc/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/specs
gcc version 2.95.2 19991024 (release)
[1:41:38pm]fivefifty:/usr/people/soren/ 46> uname -a 
Linux fivefifty 2.2.15-3SGI_39smp #1 SMP Mon Jul 24 08:45:16 EDT 2000 i686 unknown
>How-To-Repeat:
Compile and run the above code.
>Fix:
Compile with optimizations.
>Release-Note:
>Audit-Trail:
>Unformatted:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]