[Vm-dev] 3 Bugs in LargeInteger primitives

Stefan Marr smalltalk at stefan-marr.de
Wed Aug 29 11:24:39 UTC 2012

Hi Nicolas:

On 29 Aug 2012, at 12:18, Nicolas Cellier wrote:

> Beside these bugs, when I read the code, I'm quite sure it's a nest of
> future bugs because there are many other attempts to catch overflow in
> post-condition (like testing that addition of two positive is negative
> when an underflow occurs) that technically rely on explicitely
> Undefined Behaviour (UB).

I guess http://forum.world.st/Is-bytecodePrimMultiply-correct-td3869580.html
is related too.
I am not sure whether that got changed in the VMs, but sounds very much like the same kind of problem. (undefined behavior and overflows)

Since C is undefined in that regard, what are the options?
Hand-crafted assembly for all relevant platforms?
Are there libraries that abstract from these things?

I think Clang has a compiler switch to warn at compile-time, or trigger a runtime warning/error for these issues with undefined behavior. That might help for a thorough sweep through the code.

Best regards

Stefan Marr
Software Languages Lab
Vrije Universiteit Brussel
Pleinlaan 2 / B-1050 Brussels / Belgium
Phone: +32 2 629 2974
Fax:   +32 2 629 3525

More information about the Vm-dev mailing list