diff options
author | Ömer Sinan Ağacan <omeragacan@gmail.com> | 2019-09-06 16:33:19 +0300 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2019-09-11 19:40:06 -0400 |
commit | c76cc0c6fa973ae8e083db5aeb4d19f37a64bb21 (patch) | |
tree | dab37f38d556f4d7b0c518675978adc8d15c745e /rts/Stats.c | |
parent | 7ef6fe8f70156581ce8e370a90975fb96f98783a (diff) | |
download | haskell-c76cc0c6fa973ae8e083db5aeb4d19f37a64bb21.tar.gz |
Refactor bad coercion checking in a few places
We do bad coercion checking in a few places in the compiler, but they
all checked it differently:
- CoreToStg.coreToStgArgs:
Disallowed lifted-to-unlifted, disallowed changing prim reps even when
the sizes are the same.
- StgCmmExpr.cgCase:
Checked primRepSlot equality. This disallowed Int to Int64 coercions
on 64-bit systems (and Int to Int32 on 32-bit) even though those are
fine.
- CoreLint:
Only place where we do this right. Full rules are explained in Note
[Bad unsafe coercion].
This patch implements the check explained in Note [Bad unsafe coercion]
in CoreLint and uses it in CoreToStg.coreToStgArgs and
StgCmmExpr.cgCase.
This fixes #16952 and unblocks !1381 (which fixes #16893).
This is the most conservative and correct change I came up with that
fixes #16952.
One remaining problem with coercion checking is that it's currently done
in seemingly random places. What's special about CoreToStg.coreToStgArgs
and StgCmmExpr.cgCase? My guess is that adding assertions to those
places caught bugs before so we left assertions in those places. I think
we should remove these assertions and do coercion checking in CoreLint
and StgLint only (#17041).
Diffstat (limited to 'rts/Stats.c')
0 files changed, 0 insertions, 0 deletions