This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
g++ 2.95 produces wrong code
- To: gcc-bugs at gcc dot gnu dot org
- Subject: g++ 2.95 produces wrong code
- From: Thomas Kunert <kunert at physik dot tu-dresden dot de>
- Date: Tue, 21 Sep 1999 10:48:27 +0000
- Organization: TU Dresden
I sent this some weeks ago but got no reply.
The following code gives me NaN instead of the expected 2.
This error occurs with gcc-2.95, 2.95.1, 2.95.2 (cvs).
Regards,
Thomas
[tom@eeipmf tom]$ cat driver.cc
#include <iostream>
struct A
{
A() : d_(0.0){}
double d_;
};
A g() { return A(); }
A f() { g(); return A(); }
int main( int ac, char* av[] )
{
for( int i=0; i<7; ++i )f();
double d3 = 1.0;
double d4 = d3+1.0;
cout << d3 << " " << d4 << endl;
}
[tom@eeipmf tom]$ g++ driver.cc
[tom@eeipmf tom]$ ./a.out
1 NaN
[tom@eeipmf tom]$ g++ -v
Reading specs from /opt/gcc295/lib/gcc-lib/i686-pc-linux-gnu/2.95/specs
gcc version 2.95 19990728 (release)
[tom@eeipmf tom]$