Date: Sat, 28 Apr 2001 14:12:51 +0200 From: Raymond Wiker <Raymond.Wiker@fast.no> To: freebsd-stable@freebsd.org Subject: g++ bug in FreeBSD-4.3 Message-ID: <15082.46019.913297.264758@raw.grenland.fast.no>
next in thread | raw e-mail | index | archive | help
I just had a look at the gcc-bugs mailing list archive, at <URL:http://gcc.gnu.org/ml/gcc-bugs/>. The reason for this is that I spent a few hours yesterday on some code that worked about a month ago, but now misbehaves in odd ways. I suspect that if I had been a less experienced programmer, I would have suspected the compiler earlier :-) Anyway, I came across the following bug report: <URL:http://gcc.gnu.org/ml/gcc-bugs/2001-04/msg00707.html>. This looks pretty serious. The code from that bug report is reproduced below; I have verified that on my machine (4.3-STABLE FreeBSD 4.3-STABLE #0: Fri Apr 27 09:58:39 CEST 2001), the bug occurs with -O0, -O and -O2. #include <iostream> using namespace std; double f(double& x) { x=1; return 2; } int main() { double d=5; cout << f(d) << "\t" << d << endl; // the line below produces correct output of "2 1" // double y=f(d); cout << y << "\t" << d << endl; } This one is *bad* :-( I don't know how this should be handled; one option might be to have a port for gcc 2.95.2. //Raymond. -- Raymond Wiker Raymond.Wiker@fast.no To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?15082.46019.913297.264758>