summaryrefslogtreecommitdiff
path: root/testsuite/tests/simplStg/should_compile/T22212.hs
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/simplStg/should_compile/T22212.hs')
-rw-r--r--testsuite/tests/simplStg/should_compile/T22212.hs45
1 files changed, 45 insertions, 0 deletions
diff --git a/testsuite/tests/simplStg/should_compile/T22212.hs b/testsuite/tests/simplStg/should_compile/T22212.hs
new file mode 100644
index 0000000000..8a6e6c7da3
--- /dev/null
+++ b/testsuite/tests/simplStg/should_compile/T22212.hs
@@ -0,0 +1,45 @@
+{-# LANGUAGE MagicHash, UnboxedTuples #-}
+
+module T22212 where
+
+import GHC.Exts
+
+isNullAddr# :: Addr# -> (##)
+isNullAddr# a =
+ case eqAddr# a nullAddr# of
+ 1# -> (##)
+ _ -> compareBytes (##)
+{-# INLINE isNullAddr# #-}
+
+compareBytes :: (##) -> (##)
+compareBytes _ = (##)
+{-# NOINLINE compareBytes #-}
+
+mArray :: forall {rep :: RuntimeRep} {res :: TYPE rep}
+ . ( () -> () -> () -> () -> ()
+ -> () -> () -> () -> () -> ()
+ -> () -> () -> () -> () -> ()
+ -> () -> () -> () -> () -> ()
+ -> () -> () -> () -> () -> ()
+ -> res )
+ -> res
+mArray cont =
+ case isNullAddr# nullAddr# of
+ (##) ->
+ cont
+ () () () () ()
+ () () () () ()
+ () () () () ()
+ () () () () ()
+ () () () () ()
+ -- As of writing this test,
+ -- 9 arguments were required to trigger the bug.
+
+{-
+Original reproducer:
+
+data Sort = MkSort BS.ByteString [()]
+
+pattern Array :: () -> () -> Sort
+pattern Array x y = MkSort "Array" [x,y]
+-} \ No newline at end of file