[rust-dev] Integer overflow, round -2147483648

Daniel Micay danielmicay at gmail.com
Thu Jun 26 22:57:39 PDT 2014


On 27/06/14 01:38 AM, Tony Arcieri wrote:
> On Thu, Jun 26, 2014 at 10:30 PM, Daniel Micay <danielmicay at gmail.com
> <mailto:danielmicay at gmail.com>> wrote:
> 
>     It's a perfect example of a case where this feature wouldn't have
>     helped. Performance critical loops with years of micro-optimization are
>     not going to use checked arithmetic types. Every branch that the
>     programmer thinks can be avoided will be avoided.
> 
> 
> I know you're not fans of a compiler flag, but a checked debug build
> with traps you can optimize out in an optimized build could've caught it.
> 
> As it were, this is what Swift provides (in addition to explicit
> overflow operators) 

It doesn't happen on inputs that aren't pathological, a debug build with
checked overflow wouldn't have caught this. No one had considered this
issue and there was no test for it.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://mail.mozilla.org/pipermail/rust-dev/attachments/20140627/f3a56f2a/attachment.sig>


More information about the Rust-dev mailing list