This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
A bug in egcs-c++-1.1.2
- To: gcc-bugs at gcc dot gnu dot org, bug-gcc at gnu dot org
- Subject: A bug in egcs-c++-1.1.2
- From: "Abed M. Hammoud" <abed at anatomic dot com>
- Date: Wed, 24 Nov 1999 14:32:37 -0700
- Organization: IntellX, L.L.C
Hello,
I am running the egcs c++ compiler on an intell machine
with redhat 6.1. The rpm package that I have is:
egcs-c++-1.1.2-24.rpm
egcs-1.1.2-24.rpm
egcs-g77-1.1.2-24.rpm
The VERY simple program produces two different results
depending on the level of optimization.
the program listing is:
-------------------------
#include <iostream.h>
main() {
double min = 0.0;
double max = 0.5;
double width = 0.01;
cout << (int) (((max - min) / width) + 1) << endl;
}
---------------------------
when I compile it with the command:
g++ test.c -o x
the number that is printed is 50 (which is wrong).
when I compile it with the command:
g++ -O2 test.c -o x
The number that gets printed is 51 (which is correct).
Please let me know if I am overlooking anyuthing.
Note I tried using the static_cast<int> instead
of (int) and the same thing happend.
Also, I tried running the same program on a linux
box running redhat 6.0 with egcs-c++-1.1.2-12.rpm
and I had the same problems.
Please send me some feedback soon if you can as
I am porting a large project for my company
and this bug was very hard to track.
Thanks,
Abed
--
Abed M. Hammoud, D.Sc. abed@anatomic.com
Medtronic Office: (303) 439-9709
x210
Colorado, USA http://www.anatomic.com/abed