diff --git a/ghc/tests/lib/should_run/Makefile b/ghc/tests/lib/should_run/Makefile index 0f59dc74d1fbaa04cfacfbeec3e2c0cf8f3b8ded..dfd259da63e91c9b3a2430719794ccd150d64935 100644 --- a/ghc/tests/lib/should_run/Makefile +++ b/ghc/tests/lib/should_run/Makefile @@ -1,5 +1,5 @@ #----------------------------------------------------------------------------- -# $Id: Makefile,v 1.2 1998/07/08 10:36:54 simonm Exp $ +# $Id: Makefile,v 1.3 1998/08/04 15:21:15 simonm Exp $ TOP = ../.. include $(TOP)/mk/boilerplate.mk @@ -8,6 +8,7 @@ include $(TOP)/mk/should_run.mk SRC_HC_OPTS += -dcore-lint packedstring001_HC_OPTS = -syslib misc +stableptr001_RUNTEST_OPTS = +RTS -K4m SRC_MKDEPENDHS_OPTS += -syslib misc diff --git a/ghc/tests/lib/should_run/stableptr001.hs b/ghc/tests/lib/should_run/stableptr001.hs new file mode 100644 index 0000000000000000000000000000000000000000..42ee1fe58cc1837d55128311412f8fd74e7f0daf --- /dev/null +++ b/ghc/tests/lib/should_run/stableptr001.hs @@ -0,0 +1,20 @@ +{-# OPTIONS -fglasgow-exts #-} + +module Main where + +import Foreign + +-- simple test for building/dereferencing stable ptrs + +main + = do l <- mapM makeStablePtr [1..100000] + sum <- stable_sum l + print sum + +stable_sum :: [StablePtr Integer] -> IO Integer +stable_sum [] = return 0 +stable_sum (x:xs) + = do x' <- deRefStablePtr x + freeStablePtr x + xs' <- stable_sum xs + return (x' + xs') diff --git a/ghc/tests/lib/should_run/stableptr001.stdout b/ghc/tests/lib/should_run/stableptr001.stdout new file mode 100644 index 0000000000000000000000000000000000000000..90ee71a089849e181016209b833c12ebde2d7fc2 --- /dev/null +++ b/ghc/tests/lib/should_run/stableptr001.stdout @@ -0,0 +1 @@ +5000050000