<div dir="ltr">Hi Holger,<div class="gmail_extra"><br><div class="gmail_quote">On Tue, Nov 24, 2015 at 11:51 AM, Holger Freyther <span dir="ltr">&lt;<a href="mailto:holger@freyther.de" target="_blank">holger@freyther.de</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
<br>
&gt; On 24 Nov 2015, at 20:44, Eliot Miranda &lt;<a href="mailto:eliot.miranda@gmail.com">eliot.miranda@gmail.com</a>&gt; wrote:<br>
&gt;<br>
&gt; Hi All,<br>
<br>
Hi!<br>
<span class=""><br>
<br>
&gt; Given that arg and receiver can both have values &gt; 64k, the result can of course overflow and there&#39;s no guarantee that because result = rcvr * arg, that (result / arg) == rcvr.<br>
&gt;<br>
&gt; Am I missing something?  Are there flags I should be using?  This looks like a pretty basic issue.<br>
<br>
</span>I think you were already compiling with the -fwrapv option? </blockquote><div><br></div><div>Thanks, that&#39;s what I was missing.  With -fwrapv the code is generated.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Maybe it ignores it? I think the<br>
blogpost from Nicolas Cellier[1] applies? I had a similar issue with GNU Smalltalk and clang<br>
and I opted for using the GCC variant (that will be in newer clang releases too and we do not<br>
have to think about the types) in the form of the __builtin_mul_overflow (the older variants are<br>
either smul or smull and might be available in Apple&#39;s clang)[2]<br>
<br>
i hope this helps<br>
        holger<br></blockquote><div><br></div><div>indeed it does!</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">[1] <a href="http://smallissimo.blogspot.is/2015_04_01_archive.html" rel="noreferrer" target="_blank">http://smallissimo.blogspot.is/2015_04_01_archive.html</a><br>
[2] <a href="http://clang.llvm.org/docs/LanguageExtensions.html" rel="noreferrer" target="_blank">http://clang.llvm.org/docs/LanguageExtensions.html</a></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div><span style="font-size:small;border-collapse:separate"><div>_,,,^..^,,,_<br></div><div>best, Eliot</div></span></div></div></div>
</div></div>