summaryrefslogtreecommitdiff
path: root/compiler/simplStg
diff options
context:
space:
mode:
authorÖmer Sinan Ağacan <omeragacan@gmail.com>2016-08-09 22:30:56 +0000
committerÖmer Sinan Ağacan <omeragacan@gmail.com>2016-08-09 22:30:56 +0000
commite79bb2c10d66ec8f0c037e66c7d0a22aa887fdc1 (patch)
tree60063796e57d702cb468e24f34a424e52909266a /compiler/simplStg
parentdd23a4c067323cdc948a66f1c19fbd6b94374759 (diff)
downloadhaskell-e79bb2c10d66ec8f0c037e66c7d0a22aa887fdc1.tar.gz
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.
Diffstat (limited to 'compiler/simplStg')
-rw-r--r--compiler/simplStg/RepType.hs4
1 files changed, 3 insertions, 1 deletions
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)