[project @ 2001-05-18 08:49:27 by simonpj]
authorsimonpj <unknown>
Fri, 18 May 2001 08:49:27 +0000 (08:49 +0000)
committersimonpj <unknown>
Fri, 18 May 2001 08:49:27 +0000 (08:49 +0000)
Add a test for -funbox-strict-fields

ghc/tests/codeGen/should_run/Makefile
ghc/tests/codeGen/should_run/cg049.hs [new file with mode: 0644]
ghc/tests/codeGen/should_run/cg049.stdout [new file with mode: 0644]

index 75171b0..b946169 100644 (file)
@@ -1,5 +1,5 @@
 #-----------------------------------------------------------------------------
-# $Id: Makefile,v 1.18 2001/03/28 14:26:34 simonmar Exp $
+# $Id: Makefile,v 1.19 2001/05/18 08:49:27 simonpj Exp $
 
 TOP = ../..
 include $(TOP)/mk/boilerplate.mk
@@ -28,6 +28,7 @@ cg033_HC_OPTS = -fglasgow-exts
 cg035_HC_OPTS = -package lang -fglasgow-exts
 cg042_HC_OPTS = -package lang -fglasgow-exts
 cg044_HC_OPTS = -package lang
+cg049_HC_OPTS = -funbox-strict-fields
 
 cg016_RUNTEST_OPTS = -x 1      # should override the -x 0 above.
 cg021_RUNTEST_OPTS = +RTS -K2m
diff --git a/ghc/tests/codeGen/should_run/cg049.hs b/ghc/tests/codeGen/should_run/cg049.hs
new file mode 100644 (file)
index 0000000..d4b6a77
--- /dev/null
@@ -0,0 +1,22 @@
+-- !! Data constructors with strict fields
+-- This test should use -funbox-strict-fields
+
+module Main ( main ) where
+
+main = print (g (f t))
+
+t = MkT 1 2 (3,4) (MkS 5 6)
+
+g (MkT x _ _ _) = x
+
+data T = MkT Int !Int !(Int,Int) !(S Int)
+
+data S a = MkS a a 
+
+
+{-# NOINLINE f #-}
+f :: T -> T    -- Takes apart the thing and puts it
+               -- back together differently
+f (MkT x y (a,b) (MkS p q)) = MkT a b (p,q) (MkS x y)
+
+
diff --git a/ghc/tests/codeGen/should_run/cg049.stdout b/ghc/tests/codeGen/should_run/cg049.stdout
new file mode 100644 (file)
index 0000000..00750ed
--- /dev/null
@@ -0,0 +1 @@
+3