This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/16515] Bad return with a some call of functions
- From: "er_mojo_jojo at hotmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 16 Jul 2004 09:13:44 -0000
- Subject: [Bug c++/16515] Bad return with a some call of functions
- References: <20040713105222.16515.er_mojo_jojo@hotmail.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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