summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--compiler/simplStg/RepType.hs4
-rw-r--r--testsuite/tests/unboxedsums/unboxedsums_unit_tests.hs14
2 files changed, 16 insertions, 2 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)
diff --git a/testsuite/tests/unboxedsums/unboxedsums_unit_tests.hs b/testsuite/tests/unboxedsums/unboxedsums_unit_tests.hs
index 5c0b929f78..399e074991 100644
--- a/testsuite/tests/unboxedsums/unboxedsums_unit_tests.hs
+++ b/testsuite/tests/unboxedsums/unboxedsums_unit_tests.hs
@@ -42,7 +42,7 @@ uniq_tests = do
layout_tests :: IO ()
layout_tests = sequence_
- [ layout1, layout2, layout3, enum_layout ]
+ [ layout1, layout2, layout3, layout4, layout5, enum_layout ]
where
assert_layout tn tys layout =
let
@@ -75,6 +75,18 @@ layout_tests = sequence_
, ubxtup [ intPrimTy, intTy, intPrimTy, intTy ] ]
[ WordSlot, PtrSlot, PtrSlot, WordSlot, WordSlot ]
+ layout4 =
+ assert_layout "layout4"
+ [ ubxtup [ floatPrimTy, floatPrimTy ]
+ , ubxtup [ intPrimTy, intPrimTy ] ]
+ [ WordSlot, WordSlot, WordSlot, FloatSlot, FloatSlot ]
+
+ layout5 =
+ assert_layout "layout5"
+ [ ubxtup [ intPrimTy, intPrimTy ]
+ , ubxtup [ floatPrimTy, floatPrimTy ] ]
+ [ WordSlot, WordSlot, WordSlot, FloatSlot, FloatSlot ]
+
enum_layout =
assert_layout "enum"
(replicate 10 (ubxtup []))