From owner-freebsd-stable Sat Apr 28 5:13: 2 2001 Delivered-To: freebsd-stable@freebsd.org Received: from tepid.osl.fast.no (tepid.osl.fast.no [213.188.9.130]) by hub.freebsd.org (Postfix) with ESMTP id 9A31B37B424 for ; Sat, 28 Apr 2001 05:12:57 -0700 (PDT) (envelope-from Raymond.Wiker@fast.no) Received: from raw.grenland.fast.no.fast.no (fw-oslo.fast.no [213.188.9.129]) by tepid.osl.fast.no (8.9.3/8.9.1) with ESMTP id MAA37400; Sat, 28 Apr 2001 12:12:55 GMT (envelope-from Raymond.Wiker@fast.no) From: Raymond Wiker MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15082.46019.913297.264758@raw.grenland.fast.no> Date: Sat, 28 Apr 2001 14:12:51 +0200 To: freebsd-stable@freebsd.org Subject: g++ bug in FreeBSD-4.3 X-Mailer: VM 6.89 under 21.1 (patch 12) "Channel Islands" XEmacs Lucid Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG I just had a look at the gcc-bugs mailing list archive, at . 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: . 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 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