This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Wow!
- From: "Lev Assinovsky" <LAssinovsky at algorithm dot aelita dot com>
- To: "Gcc-Bugs (E-mail)" <gcc-bugs at gcc dot gnu dot org>
- Date: Sat, 6 Sep 2003 15:40:22 +0400
- Subject: Wow!
Hello all!
How about that:
-------------- cut here ------------------------------------------------
#include <iostream>
using namespace std;
int f1()
{
return 1;
}
int f2(const int n)
{
cout << n << endl;
return 2;
}
int main()
{
int k=0;
if ((k = f1() == -1) || (f2(k) == -1))
{
cout << "Shouldn't be here" << endl;
}
}
---------------- cut here ----------------------------------------
What will be printed from f2 with gcc 3.2, gcc 3.3.1?
0!!!!!!!
It is a bug. Isn't it?
----
Lev Assinovsky
Aelita Software Corporation
O&S Core Division, Programmer
ICQ# 165072909