[94] in Pthreads mailing list archive
Re: Linux ELF
daemon@ATHENA.MIT.EDU (Ken Raeburn)
Thu Aug 17 17:08:02 1995
Date: Thu, 17 Aug 1995 16:42:11 -0400
From: Ken Raeburn <raeburn@cygnus.com>
To: hjl@nynexst.com (H.J. Lu)
Cc: pthreads@MIT.EDU
In-Reply-To: hjl@nynexst.com's message of Thu, 17 Aug 95 15:58:19 EDT
In article <9508171958.AA26118@nynexst.com> hjl@nynexst.com (H.J. Lu) writes:
> Fails to *complete* (i.e., runs forever), or completes with a failure
> indication?
In my case, it aborted.
That's what I'd expect, but that wasn't what I read into the wording
of the original message.
That is how gcc works. It only shows up if you use -O. Depending
on the x87 control word, by default, x87 may use 10 byte fp format for
fp computation internally. When you use
double x, y;
.....
if (x == y)
x and y may be equal in 8 byte double format. But there may be
a small difference in 10 byte fp format. When -O is used, gcc
may use the x87 registers directly without converting 10 byte
fp into 8 byte double and than loading them into the 10 byte
registers. That is a good thing for optimization. But the
comparison may fail.
A good thing for optimization, yes, but a bad thing for trying to
verify the consistency of the floating point state. On the other
hand, performance isn't relevant in the latter case. If x and y are
forced into memory (e.g., by being allocated on the heap, or being
accessed through pointers) and marked "volatile", such optimizations
should not be possible. And if the x87 widens x and y when reading
them back from the 8-byte format in memory, they should be widened the
same way.