This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: c++/5692: g++ 2.96, ix86: (int)(x*y) result depends on statementsnear it like cout << endl
- From: Kreinin Yosef <yosefk at cs dot huji dot ac dot il>
- To: ljrittle at gcc dot gnu dot org, gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, nobody at gcc dot gnu dot org, yosefk at cs dot huji dot ac dot il, gcc-gnats at gcc dot gnu dot org
- Date: Wed, 27 Feb 2002 13:12:47 +0200 (IST)
- Subject: Re: c++/5692: g++ 2.96, ix86: (int)(x*y) result depends on statementsnear it like cout << endl
Is the result DEFINED in ISO C? I do not expect ANYTHING from this test.
I don't care what the result is, it should not depend on cout << endl
added to the code or removed from it, that's the problem.
SAME CPU.
SAME OS.
SAME COMPILATION, except for removing cout << endl by conditional
compilation.
DIFFERENT RESULT.
If the result is DEFINED in the standard, it should not depend on
such statements.
If it is said to be UNDEFINED, then it's OK. But how on earth
an addition of a PRINT STATEMENT may affect an FP COMPUTATION near it,
may that be considered fine?
OF COURSE I MAY GET AN ERROR OF 1 WHEN CASTING DOUBLES CLOSE TO AN
INTEGER, BUT IT HAS NOTHING TO DO WITH WHAT I REPORTED.
Please reply, especially if ISO C specifies the result to be undefined.
On 14 Feb 2002 ljrittle@gcc.gnu.org wrote:
| Synopsis: g++ 2.96, ix86: (int)(x*y) result depends on statements near it like cout << endl
|
| State-Changed-From-To: open->closed
| State-Changed-By: ljrittle
| State-Changed-When: Thu Feb 14 13:51:34 2002
| State-Changed-Why:
| Some FP hardware and OSes will support your test by
| their design but...
|
| Please consider that ISO C does not guarantee that your
| test will work as you expect. You want to learn about
| the concepts related to a standard macro DBL_EPSILON .
|
| http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=5692
|