delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1996/10/19/13:46:52

From: dcf AT interactive DOT net ("David C. Feldmeier")
Subject: floating point optimization bug, beta version 16 of GCC
19 Oct 1996 13:46:52 -0700 :
Sender: daemon AT cygnus DOT com
Approved: cygnus DOT gnu-win32 AT cygnus DOT com
Distribution: cygnus
Message-ID: <1.5.4.32.19961019195447.006b8254.cygnus.gnu-win32@interactive.net>
Mime-Version: 1.0
X-Sender: dcf AT interactive DOT net
X-Mailer: Windows Eudora Light Version 1.5.4 (32)
Original-To: gnu-win32 AT cygnus DOT com
Original-Cc: dcf AT onyx DOT interactive DOT net
Original-Sender: owner-gnu-win32 AT cygnus DOT com

I have been using your GCC for several months now, and I've generally had
good luck with it.  However, I seems to have found an optimizer bug.  Here
is some code that shows the bug:

?* START OF CODE */
#
/* bug.c
 *
 * David C. Feldmeier
 * October 19, 1996
 *
 */

#include <stdio.h>
#include <stdlib.h>

static void func_B(
unsigned long redundancy) { /* percentage of redundancy to use */
  printf ("inv redund %f, test %f\n", 100.0/(double)redundancy,
	  100.0/(double)300L);
}

int main() {
  unsigned long redundancy = 300L;
  func_B(redundancy);
}
/* END OF CODE */

Here is the list of commands given to bash:

bash$ gcc -o bug.exe bug.c
bash$ bug
inv redund 0.333333, test 0.333333
bash$ gcc -O1 -o bug.exe bug.c
bash$ bug
inv redund 0.000000, test 0.333333
bash$

As you can see, when the optimizer is running, it the code generates an
incorrect floating point result.

The code which generates this bug is no different than code that I ran
sucessfully using a previous version (13, I believe) of GCC.  Also, this bug
may be related to a floating point problem reported by Peter Fan to the
mailing list on April 30, 1996.

I am running the lastest version of the GCC compiler, beta release 16.  My
computer is a 133 MHz Pentium Micron Millenia with 16M RAM.  I am running
GCC using the DOS emulator under Windows95.  If you need any other
information, please let me know.  Thanks.

                                                        -Dave

-
For help on using this list, send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019