summaryrefslogtreecommitdiff
path: root/testsuite/tests/rts/cloneMyStack2.hs
blob: 068c816ce5c2dfc1e27df05b2c6aec86eacd7a3b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
{-# LANGUAGE BangPatterns #-}
module Main where

import GHC.Stack.CloneStack

main = foo 100

{-# NOINLINE foo #-}
foo 0 = () <$ getStack
foo n = print "x" >> foo (n - 1) >> print "x"

-- This shouldn't segfault
getStack = do
  !s <- cloneMyStack
  return ()