[Vm-dev] clang and bytecodePrimMultiply
holger at freyther.de
Tue Nov 24 19:51:44 UTC 2015
> On 24 Nov 2015, at 20:44, Eliot Miranda <eliot.miranda at gmail.com> wrote:
> Hi All,
> Given that arg and receiver can both have values > 64k, the result can of course overflow and there's no guarantee that because result = rcvr * arg, that (result / arg) == rcvr.
> Am I missing something? Are there flags I should be using? This looks like a pretty basic issue.
I think you were already compiling with the -fwrapv option? Maybe it ignores it? I think the
blogpost from Nicolas Cellier applies? I had a similar issue with GNU Smalltalk and clang
and I opted for using the GCC variant (that will be in newer clang releases too and we do not
have to think about the types) in the form of the __builtin_mul_overflow (the older variants are
either smul or smull and might be available in Apple's clang)
i hope this helps
More information about the Vm-dev