This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/28796] __builtin_nan() and __builtin_unordered() inconsistent
- From: "iano at apple dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 22 Aug 2006 02:05:48 -0000
- Subject: [Bug middle-end/28796] __builtin_nan() and __builtin_unordered() inconsistent
- References: <bug-28796-13128@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #12 from iano at apple dot com 2006-08-22 02:05 -------
"That however is not a clear bug.
-ffinite-math-only says that it assumes that there are no NaNs in the
input, and you violated that assumption, so the results you will get are
undefined. That is, gcc is allowed to give you any answer here. One
can argue that the documentation could be improved to indicate this.
One could perhaps also argue that this feature is poorly designed. One
can't argue that this is an obvious bug."
Let's go with your interpretation for a moment here:
If -ffinite-math-only says that it "assumes that there are no NaNs in the
input" , then it should not return a result saying that there are NaNs there. I
don't think the results here are undefined. I think the results are pretty
clear. This is a bug.
But, yes, you are mostly right. I want something very feature-ish. I would
like you to fix/clarify the design you already have in a direction that works
well for users. I would like those builtins (or maybe some other hypothetical
future builtins) to function correctly all the time, no matter what. In that
regard, I think that the fact that __builtin_isunordered() does the right thing
in that particular case is pretty nifty. I just can't depend on it, so it's a
useless behavior.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28796