#4321: Unexpected stack overflow prevented by superfluous type annotation
-------------------------------+--------------------------------------------
Reporter: bjpop | Owner:
Type: bug | Status: new
Priority: normal | Milestone: 7.4.1
Component: Compiler | Version: 6.13
Resolution: | Keywords:
Os: Unknown/Multiple | Architecture: Unknown/Multiple
Failure: None/Unknown | Difficulty:
Testcase: T4321 | Blockedby:
Blocking: | Related:
-------------------------------+--------------------------------------------
Changes (by michalt):
* status: closed => new
* resolution: fixed =>
Comment:
Unfortunately the current HEAD fails T4321 for me due to stack overflow.
It
seems that the problem is similar -- ```sum``` doesn't get inlined by
current
HEAD whereas GHC 7.4 does inline it.
Maybe I'm missing something, but it seems to me that an easy fix would be
to
slightly modify the definition of ```sum```:
{{{
sum l = sum' l 0
where
sum' [] a = a
sum' (x:xs) a = sum' xs (a+x)
}}}
by making ```sum'``` strict in the second argument or by defining it as
```foldl' (+) 0```. Is there any reason not to do that?
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4321#comment:16>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs