diff options
author | Ryan Scott <ryan.gl.scott@gmail.com> | 2018-01-02 16:03:08 -0500 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2018-01-02 17:33:04 -0500 |
commit | ecff651fc2f6d9833131e3e7fbc9a37b5b2f84ee (patch) | |
tree | 64e0723c19b638e6389b598a802321acd87e738c /compiler/ghci | |
parent | 46287af0911f7cb446c62850630f85af567ac512 (diff) | |
download | haskell-ecff651fc2f6d9833131e3e7fbc9a37b5b2f84ee.tar.gz |
Fix #14608 by restoring an unboxed tuple check
Commit 714bebff44076061d0a719c4eda2cfd213b7ac3d removed
a check in the bytecode compiler that caught illegal uses of unboxed
tuples (and now sums) in case alternatives, which causes the program
in #14608 to panic. This restores the check (using modern,
levity-polymorphic vocabulary).
Test Plan: make test TEST=T14608
Reviewers: hvr, bgamari, dfeuer, simonpj
Reviewed By: dfeuer, simonpj
Subscribers: simonpj, rwbarton, thomie, carter
GHC Trac Issues: #14608
Differential Revision: https://phabricator.haskell.org/D4276
Diffstat (limited to 'compiler/ghci')
-rw-r--r-- | compiler/ghci/ByteCodeGen.hs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/compiler/ghci/ByteCodeGen.hs b/compiler/ghci/ByteCodeGen.hs index 697dc63b43..d5370805ea 100644 --- a/compiler/ghci/ByteCodeGen.hs +++ b/compiler/ghci/ByteCodeGen.hs @@ -962,6 +962,11 @@ doCase d s p (_,scrut) bndr alts is_unboxed_tuple | null real_bndrs = do rhs_code <- schemeE d_alts s p_alts rhs return (my_discr alt, rhs_code) + -- If an alt attempts to match on an unboxed tuple or sum, we must + -- bail out, as the bytecode compiler can't handle them. + -- (See Trac #14608.) + | any (\bndr -> typePrimRep (idType bndr) `lengthExceeds` 1) bndrs + = multiValException -- algebraic alt with some binders | otherwise = let (tot_wds, _ptrs_wds, args_offsets) = |