[Bug c++/16515] Bad return with a some call of functions
er_mojo_jojo at hotmail dot com
gcc-bugzilla@gcc.gnu.org
Fri Jul 16 09:13:00 GMT 2004
------- Additional Comments From er_mojo_jojo at hotmail dot com 2004-07-16 09:13 -------
Sorry for the explication of the bug. We make a new explication with a simples
fuctions. There are A(), B(int) and C(int).
double
A(){
return ( sqrt ( pow ( (double) B(1) , 2 ) + pow ((double) C(2) , 2 ) ) );
}
int
B( int d){
return d;
}
int
C(int e){
return e;
}
void
main{
if (A()==A())
cout << ÂTrueÂ;
else
cout<<ÂFalseÂ;
}
Our question is why main print False with this functions in the compile 3.2.1,
and print True in the version 3.2.2.
Well, if we changed the structure of function A() creating a variable double,
the version of compile 3.2.1 print True. The changes are these:
double
A(){
double f;
f= sqrt ( pow ( (double) B(1) , 2 ) + pow ((double) C(2) , 2 ) )
return f;
}
In this function arenÂt the mistake, but in our practice we use the first
function A() and the program works well in the compile 3.2.2 but bad in the
version 3.2.1. We would know why happen this mistake in the version 3.2.1 and
not in the version 3.2.2.
Thanks for the answer.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16515
More information about the Gcc-bugs
mailing list