Skip to content

A working program reports <<loop>> when compiled with -O

If the attached module Trampoline.hs is compiled with no optimizations it works:

$ ghc --make Trampoline.hs   
[1 of 1] Compiling Main             ( Trampoline.hs, Trampoline.o )
Linking Trampoline ...
$ ./Trampoline 
...
((5,2),(1,2,6))
$ 

With optimizations on, it hangs:

$ ghc --make Trampoline.hs -O
[1 of 1] Compiling Main             ( Trampoline.hs, Trampoline.o )
Linking Trampoline ...
$ ./Trampoline 
bounce start
bounce end
liftOut
inject suspend
Trampoline: <<loop>>

That doesn't seem right. Oh, GHCi runs it with no problem as well.

Trac metadata
Trac field Value
Version 6.10.4
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information