Skip to content

GHC goes into an apparently infinite loop at -O2

I ran across a peculiar case this evening: a benchmark that I can't compile with -O2, because GHC goes into an infinite loop.

I have a very small repro at https://github.com/bos/inttable/blob/2d529c693f4c9a2903dae8f640759a05e7d20c69/Repro.hs

You can grab the necessary code and reproduce as follows:

git clone git://github.com/bos/inttable.git
cd inttable
ghc -O2 --make Repro

With GHC 7.6.3, this goes into an infinite loop. If I compile with -v3, I see that GHC freezes here:

*** SpecConstr:
Result size of SpecConstr

This never prints any output. Since the compiler isn't allocating more memory, I assume that it's stuck in a loop, rather than doing something productive.

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