summaryrefslogtreecommitdiff
path: root/testsuite/tests/rts/cloneMyStack2.hs
blob: e00a263d804eaf013ba4cfb3c10ea10f8d4739ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
{-# 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 ()