Bad g++ bug

Thomas Kunert kunert@physik.tu-dresden.de
Wed Sep 8 00:25:00 GMT 1999


Hi,
The following code gives me NaN instead of the expected 2.

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]$


More information about the Gcc-bugs mailing list