<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<br>
<div class="moz-cite-prefix">On 06/06/2014 01:02 PM, Chandler
Carruth wrote:<br>
</div>
<blockquote
cite="mid:CAGCO0KhcD77yedxD-3E4Y7_UOnGN2W=+ShRtx07rSQXpYq8opA@mail.gmail.com"
type="cite">
<div dir="ltr">
<div class="gmail_extra"><br>
<div class="gmail_quote">On Fri, Jun 6, 2014 at 12:52 PM,
Stephen Canon <span dir="ltr"><<a moz-do-not-send="true"
href="mailto:scanon@apple.com" target="_blank">scanon@apple.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>This appears to have nothing to do with signbit, but
rather that we are somehow “optimizing” –NaN —> NaN.</div>
<div><br>
</div>
<div>
<div style="margin:0px;font-size:11px;font-family:Menlo"><span
style="color:#35568a">int</span> main(<span
style="color:#35568a">int</span> argc, <span
style="color:#35568a">char</span> *argv[]) {</div>
<div style="margin:0px;font-size:11px;font-family:Menlo">
<span style="color:#35568a">double</span> x =
-__builtin_nan(<span style="color:#e82300">""</span>);</div>
<div style="margin:0px;font-size:11px;font-family:Menlo">
printf(<span style="color:#e82300">"%d\t%d\n"</span>,
signbit(x));</div>
<div
style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(53,86,138)"><span
style="color:#000000"> </span>return<span
style="color:#000000"> </span>0<span
style="color:#000000">;</span></div>
<div style="margin:0px;font-size:11px;font-family:Menlo">}</div>
</div>
<div style="margin:0px;font-size:11px;font-family:Menlo"><br>
</div>
this prints zero on recent clang (should print 1).
Stepping through, x is being set to a positive NaN.</blockquote>
</div>
<br>
The standards for C and C++, and consequentially Clang and
LLVM, are terribly underspecified w.r.t. things like NaN
behavior. =/ We have seen this before, and even if we fix it
in Clang/LLVM I worry that it will regress as there are many
places where we model NaNs in a manner slightly too aggressive
to be strictly IEEE-754 conforming. =[</div>
</div>
</blockquote>
Is being IEEE-754 conforming a worthwhile goal? If so, we could
talk about how to improve testing to prevent such regressions and
find other latent bugs. <br>
<br>
I would generally argue in favour of conformance, but am not
familiar with exactly what the C/C++ rules are. <br>
<br>
To say this differently, are there important optimizations we don't
want to loose which aren't conforming? <br>
<br>
Philip<br>
</body>
</html>