summaryrefslogtreecommitdiff
path: root/rts/sm
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2019-07-26 10:41:44 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-05-13 02:02:33 -0400
commitcf4f1e2f78840d25b132de55bce1e02256334ace (patch)
tree19b0b6e268c574763eb09e0798c9cceb5c0dfdb2 /rts/sm
parentb352d63cbbfbee69358c198edd876fe7ef9d63ef (diff)
downloadhaskell-cf4f1e2f78840d25b132de55bce1e02256334ace.tar.gz
rts/CNF: Fix fixup comparison function
Previously we would implicitly convert the difference between two words to an int, resulting in an integer overflow on 64-bit machines. Fixes #16992
Diffstat (limited to 'rts/sm')
-rw-r--r--rts/sm/CNF.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/rts/sm/CNF.c b/rts/sm/CNF.c
index 43a090fd42..2c701c2c29 100644
--- a/rts/sm/CNF.c
+++ b/rts/sm/CNF.c
@@ -1020,8 +1020,9 @@ cmp_fixup_table_item (const void *e1, const void *e2)
{
const StgWord *w1 = e1;
const StgWord *w2 = e2;
-
- return *w1 - *w2;
+ if (*w1 > *w2) return +1;
+ else if (*w1 < *w2) return -1;
+ else return 0;
}
static StgWord *