Commit Graph

2 Commits

Author SHA1 Message Date
Felix S. Klock II
4394720dae Fix the overflowing tests in run-fail.
* The error patterns had a typo.

* Our current constant evaluation would silently allow the overflow
  (filed as Issue 22531).

* The overflowing-mul test was accidentally doing addition instead of
  multiplication.
2015-03-03 12:10:20 +01:00
Corey Richardson
cdfff9db35 rustc: implement arithmetic overflow checking
Adds overflow checking to integer addition, multiplication, and subtraction
when `-Z force-overflow-checks` is true, or if `--cfg ndebug` is not passed to
the compiler. On overflow, it panics with `arithmetic operation overflowed`.
Also adds `overflowing_add`, `overflowing_sub`, and `overflowing_mul`
intrinsics for doing unchecked arithmetic.

[breaking-change]
2015-03-03 12:09:07 +01:00