Mail Archives: cygwin/1996/10/19/13:46:52
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 -