Stack Overflow Panic

Wolfgang Thaller wolfgang.thaller at gmx.net
Sat Mar 2 17:19:31 EST 2002


I've checked out GHC 5.03 from CVS a few days ago
and compiled it on my MacOS X machine. The compiler panics 
with stack overflow on the following file:

\begin{code}
module CrashingMonad where

data PPResult a = PPSuccess a PPState
newtype PP a = PP (PPState -> PPResult a)

data PPState = PPState (PP ())

instance Monad PP where

	a >>= b = a `ppThen` b

	return x = ppReturn x

ppReturn x = undefined -- PP (\state -> PPSuccess x state)

(PP a) `ppThen` b = 
	PP (\state -> case (a state) of

		PPSuccess x state' -> 
			undefined -- case (b x) of PP b' -> b' state'
	)
							

test =	ppReturn 1 `ppThen` 
		undefined -- ppReturn
\end{code}

I don't think it's a problem with my MacOS X port,
after all it compiled the library and some other modules of my
program without problems.
Increasing the maximum stack size only delays the panic.
If I simplify the above module any further, the panic goes away.
(Replacing the "undefined"s by the commented out expressions changes
nothing).

There is no problem with ghc-5.02.2 on Intel. I cannot try it out
on ghc-5.03/intel due to lack of disk space.

Any Ideas?


Wolfgang Thaller

-- 
GMX - Die Kommunikationsplattform im Internet.
http://www.gmx.net




More information about the Glasgow-haskell-bugs mailing list