aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/runtime/rt.zc1
-rw-r--r--tests/conformance/known.txt2
2 files changed, 1 insertions, 2 deletions
diff --git a/src/runtime/rt.zc b/src/runtime/rt.zc
index 4e52cb5..7018915 100644
--- a/src/runtime/rt.zc
+++ b/src/runtime/rt.zc
@@ -363,6 +363,7 @@ int zudiv(int n, int dv) {
int zdiv(int a, int b) {
word s = 0; int q;
if (b == 0) { zrem = a; return 0; }
+ if (b == 0 - 1) { zrem = 0; return 0 - a; } // INT_MIN / -1 is INT_MIN and its remainder 0 (spec 3.4.3); zudiv can't take 2^63
if (a < 0) { a = 0 - a; s = 1; }
if (b < 0) { b = 0 - b; s = s ^ 1; }
q = zudiv(a, b);
diff --git a/tests/conformance/known.txt b/tests/conformance/known.txt
index 4d949fa..df4c94b 100644
--- a/tests/conformance/known.txt
+++ b/tests/conformance/known.txt
@@ -32,8 +32,6 @@
3-expressions/float_division_int_stored.zc zc0 b types are read and dropped: no conversion, no sized cut (appendix a)
3-expressions/float_int_ops_on_bits.zc zc0 b types are read and dropped: no conversion, no sized cut (appendix a)
3-expressions/incr_on_float_changes_bits.zc zc0 b types are read and dropped: no conversion, no sized cut (appendix a)
-3-expressions/int_min_div_minus1.zc zc0 b INT_MIN / -1 gives 0 and % gives INT_MIN in zc0
-3-expressions/int_min_mod_minus1.zc zc0 b INT_MIN / -1 gives 0 and % gives INT_MIN in zc0
3-expressions/prec_as_binds_tight.zc zc0 b types are read and dropped: no conversion, no sized cut (appendix a)
4-statements/return_value_converted_float.zc zc0 b types are read and dropped: no conversion, no sized cut (appendix a)
4-statements/return_value_converted_int.zc zc0 b types are read and dropped: no conversion, no sized cut (appendix a)