> On 22 May 2015, at 04:00, nicolas cellier 
> <[email protected]> wrote:
> 


> That's exactly it. Overflow is undefined behavior.
> The C compiler has a license to ignore undefined behavior because you are
> not suppose to rely on it.

Yes, but I couldn’t cite the relevant specification but you did in your blog 
post. I had
pointed Esteban to use “-fsanitize=undefined” in the PharoVM. E.g. there are 
more
issues with bitShift: in Pharo.


> And see a fix in
> http://smallissimo.blogspot.fr/2015/04/removing-ub-in-bytecodeprimmultiply.html.

oh, I think my preference is to go with __builtin_mul_overflow (or for clang 
the smull
variant as it can’t derive the types itself). The benefit of these routines is 
that one
passes plenty of semantics that the compiler can generate efficient code.

thanks for hanging out here and commenting!

holger
_______________________________________________
help-smalltalk mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/help-smalltalk

Reply via email to