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
[EMAIL PROTECTED]


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-stable" in the body of the message

Reply via email to