Serious bug
Ryszard Kabatek
rysio@rumcajs.chemie.uni-halle.de
Thu Sep 24 02:37:00 GMT 1998
There is a serious bug either in the compiler or in the library.
The source below must produce the folowing output:
1
0
1
On Linux (gcc-2.8.1 and egcs-1.1) I get:
0
5.11396e-15
1
On AIX (gcc-2.7.2) the output is correct:
1
0
1
// main.cc
# include <iostream.h>
class X {
public:
X(double x, double y) : fx(x), fy(y) {}
double func() {return fx + fy;}
private:
double fx;
double fy;
};
int main()
{
X x(100.1, 0.01);
double x1 = x.func();
double x2 = x.func();
cout << (x1 == x.func()) << '\n';
cout << (x1 - x.func()) << '\n';
cout << (x1 == x2) << '\n';
}
Ryszard Kabatek
---
Martin-Luther University Halle-Wittenberg
Department of Physical Chemistry
Geusaer Str. 88, 06217 Merseburg, Germany
Tel. +49 3461 46 2487 Fax. +49 3461 46 2129
More information about the Gcc-bugs
mailing list