From e79bb2c10d66ec8f0c037e66c7d0a22aa887fdc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96mer=20Sinan=20A=C4=9Facan?= Date: Tue, 9 Aug 2016 22:30:56 +0000 Subject: Fix a bug in unboxed sum layout generation We need to maintain the invariant that the layout fields are always sorted. Two tests that were previously broken are added. --- compiler/simplStg/RepType.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'compiler/simplStg') diff --git a/compiler/simplStg/RepType.hs b/compiler/simplStg/RepType.hs index 7e42a866b0..ca8438eec1 100644 --- a/compiler/simplStg/RepType.hs +++ b/compiler/simplStg/RepType.hs @@ -199,7 +199,9 @@ ubxSumRepType constrs0 = | Just s' <- s `fitsIn` es = -- found a slot, use it s' : merge ess ss - + | s < es + = -- we need a new slot and this is the right place for it + s : merge (es : ess) ss | otherwise = -- keep searching for a slot es : merge ess (s : ss) -- cgit v1.2.1