From f482638145c0acd4d18163bec71bf3ad3987b99e Mon Sep 17 00:00:00 2001
From: simonmar <unknown>
Date: Mon, 4 Sep 2000 15:23:55 +0000
Subject: [PATCH] [project @ 2000-09-04 15:23:55 by simonmar] Test for freeing
 StablePtrs.

---
 ghc/tests/lib/should_run/Makefile            |  4 +++-
 ghc/tests/lib/should_run/stableptr004.hs     | 12 ++++++++++++
 ghc/tests/lib/should_run/stableptr004.stdout |  2 ++
 3 files changed, 17 insertions(+), 1 deletion(-)
 create mode 100644 ghc/tests/lib/should_run/stableptr004.hs
 create mode 100644 ghc/tests/lib/should_run/stableptr004.stdout

diff --git a/ghc/tests/lib/should_run/Makefile b/ghc/tests/lib/should_run/Makefile
index 521f66d02d3a..2a14739a149d 100644
--- a/ghc/tests/lib/should_run/Makefile
+++ b/ghc/tests/lib/should_run/Makefile
@@ -1,5 +1,5 @@
 #-----------------------------------------------------------------------------
-# $Id: Makefile,v 1.23 2000/06/29 21:08:02 panne Exp $
+# $Id: Makefile,v 1.24 2000/09/04 15:23:55 simonmar Exp $
 
 TOP = ../..
 include $(TOP)/mk/boilerplate.mk
@@ -12,6 +12,7 @@ exceptions001_HC_OPTS   = -fglasgow-exts -fno-warn-missing-methods
 stableptr001_HC_OPTS    = -fglasgow-exts
 stableptr002_HC_OPTS    = -fglasgow-exts
 stableptr003_HC_OPTS    = -fglasgow-exts
+stableptr004_HC_OPTS    = -fglasgow-exts
 list001_HC_OPTS         = -fglasgow-exts
 uri001_HC_OPTS		= -package lang -package net
 time001_HC_OPTS	        = -package lang
@@ -21,6 +22,7 @@ enum02_HC_OPTS		= -cpp -fglasgow-exts -H12m
 enum03_HC_OPTS		= -cpp -fglasgow-exts -H12m
 
 stableptr001_RUNTEST_OPTS = +RTS -K4m
+stableptr004_RUNTEST_OPTS = +RTS -K4m
 dynamic001_HC_OPTS = -package lang
 dynamic002_HC_OPTS = -package lang
 
diff --git a/ghc/tests/lib/should_run/stableptr004.hs b/ghc/tests/lib/should_run/stableptr004.hs
new file mode 100644
index 000000000000..523bdb228a7a
--- /dev/null
+++ b/ghc/tests/lib/should_run/stableptr004.hs
@@ -0,0 +1,12 @@
+import StablePtr
+
+-- compile without optimisation.
+-- run with +RTS -D256 to see the stable pointer being garbage collected.
+
+main = do
+  let xs = [ 1 .. 50000 ]
+  let ys = [ 1 .. 60000 ]
+  s1 <- makeStablePtr xs
+  print (sum xs)
+  freeStablePtr s1
+  print (sum ys)
diff --git a/ghc/tests/lib/should_run/stableptr004.stdout b/ghc/tests/lib/should_run/stableptr004.stdout
new file mode 100644
index 000000000000..30e717b5bd5c
--- /dev/null
+++ b/ghc/tests/lib/should_run/stableptr004.stdout
@@ -0,0 +1,2 @@
+1250025000
+1800030000
-- 
GitLab