From ecff651fc2f6d9833131e3e7fbc9a37b5b2f84ee Mon Sep 17 00:00:00 2001 From: Ryan Scott Date: Tue, 2 Jan 2018 16:03:08 -0500 Subject: 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 --- compiler/ghci/ByteCodeGen.hs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'compiler') 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) = -- cgit v1.2.1