<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 27 April 2018 at 17:09, Chandler Carruth via cfe-commits <span dir="ltr"><<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><span class=""><div dir="ltr">On Fri, Apr 27, 2018 at 4:36 PM Richard Smith via cfe-commits <<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 27 April 2018 at 16:07, Sanjay Patel via cfe-commits <span dir="ltr"><<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Missing dash corrected at r331057. I can improve the doc wording, but let's settle on the flag name first, and I'll try to get it all fixed up in one shot.<br><br>So far we have these candidates:<br>1. -ffp-cast-overflow-workaround<br>2. -fstrict-fp-trunc-semantics<br>3. -fstrict-fp-cast-overflow<br><br></div>I don't have a strong opinion here, but on 2nd reading, it does seem like a 'strict' flag fits better with existing options.</div></blockquote><div><br></div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>The corresponding UBSan check is called -fsanitize=float-cast-<wbr>overflow, so maybe -fno-strict-float-cast-<wbr>overflow would be the most consistent name?</div></div></div></div></blockquote><div><br></div></span><div>On this topic: we were hit by this on a *lot* of code. All of that code builds and passes tests with -fsanitize=float-cast-<wbr>overflow. So I think we've been mistaken in assuming that this sanitizer catches all of the failure modes of the optimization. That at least impacts the sanitizer suggestion in the release notes. And probably impacts the flag name / attribuet name.</div></div></div></blockquote><div><br></div><div>That's interesting, and definitely sounds like a bug (either the sanitizer or LLVM is presumably getting the range check wrong). Can you point me at an example?</div><div><span style="color:rgb(80,0,80)"> </span></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div><div class="h5"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="m_851591361128392587m_-2739937360417644156HOEnZb"><div class="m_851591361128392587m_-2739937360417644156h5"><div class="gmail_extra"><div class="gmail_quote">On Fri, Apr 27, 2018 at 4:41 PM, Richard Smith <span dir="ltr"><<a href="mailto:richard@metafoo.co.uk" target="_blank">richard@metafoo.co.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span>On 27 April 2018 at 09:21, Sanjay Patel via cfe-commits <span dir="ltr"><<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: spatel<br>
Date: Fri Apr 27 09:21:22 2018<br>
New Revision: 331056<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=331056&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project?rev=331056&view=rev</a><br>
Log:<br>
[docs] add -ffp-cast-overflow-workaround to the release notes<br>
<br>
This option was added with:<br>
D46135<br>
rL331041<br>
...copying the text from UsersManual.rst for more exposure.<br>
<br>
<br>
Modified:<br>
    cfe/trunk/docs/ReleaseNotes.<wbr>rst<br>
<br>
Modified: cfe/trunk/docs/ReleaseNotes.<wbr>rst<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ReleaseNotes.rst?rev=331056&r1=331055&r2=331056&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/docs/<wbr>ReleaseNotes.rst?rev=331056&<wbr>r1=331055&r2=331056&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/docs/ReleaseNotes.<wbr>rst (original)<br>
+++ cfe/trunk/docs/ReleaseNotes.<wbr>rst Fri Apr 27 09:21:22 2018<br>
@@ -83,6 +83,15 @@ Non-comprehensive list of changes in thi<br>
 New Compiler Flags<br>
 ------------------<br>
<br>
+- :option:`-ffp-cast-overflow-<wbr>workaround` and<br>
+  :option:`-fnofp-cast-overflow-<wbr>workaround`<br></blockquote><div><br></div></span><div>Shouldn't this be -fno-fp-cast-overflow-<wbr>workaround?</div><div><br></div><div>Also, our convention for flags that define undefined behavior is `-fno-strict-*`, so perhaps this should be `-fno-strict-fp-cast-overflow`<wbr>?</div><span><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+  enable (disable) a workaround for code that casts floating-point values to<br>
+  integers and back to floating-point. If the floating-point value is not<br>
+  representable in the intermediate integer type, the code is incorrect<br>
+  according to the language standard.</blockquote><div><br></div></span><div>I find this hard to read: I initially misread "the code is incorrect according to the language standard" as meaning "Clang will generate code that is incorrect according to the language standard". I think what you mean here is "the code has undefined behavior according to the language standard, and Clang will not guarantee any particular result. This flag causes the behavior to be defined to match the overflowing behavior of the target's native float-to-int conversion instructions."</div><span><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This flag will attempt to generate code<br>
+  as if the result of an overflowing conversion matches the overflowing behavior<br>
+  of a target's native float-to-int conversion instructions.<br>
+<br>
 - ...<br>
<br>
 Deprecated Compiler Flags<br>
<br>
<br>
______________________________<wbr>_________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-commits</a><br>
</blockquote></span></div><br></div></div>
</blockquote></div><br></div>
</div></div><br>______________________________<wbr>_________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-commits</a><br>
<br></blockquote></div></div></div>
______________________________<wbr>_________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-commits</a><br>
</blockquote></div></div></div></div>
<br>______________________________<wbr>_________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-commits</a><br>
<br></blockquote></div><br></div></div>