Skip to content

Compiler hangs - UdecidableInstances

Normally I wouldn't consider GHC going into infinite loop when UndecidableInstances is enabled as a bug, because compiler still terminates unless maybe something like -freduction-depth=0 is supplied. That is not the case with this few lines of Haskell, as they cause GHC to hang for good and even made it use up all of my 32Gb of RAM, while I was looking the other way. Seems a bit unusual for GHC, so here is a record of it as a bug report. Compiling with -v3 stops here:

[1 of 1] Compiling Nested           ( src/Nested.hs, .stack-work/dist/x86_64-linux/Cabal-2.0.0.2/build/Nested.o )
*** Parser [Nested]:
!!! Parser [Nested]: finished in 1.03 milliseconds, allocated 0.566 megabytes
*** Renamer/typechecker [Nested]:

Compilation with GHC 8.0.2 goes through just fine. Although, I did encounter it hanging as part of a much bigger picture because of the same few lines of code. Coming up with a small reproducible example is much harder for that case as it hangs while compiling the test suite, instead of the offending module.

In order to replicate the problem, the included code has to be compiled as a library rather than as an executable. Using stack build --install-ghc should do it.

Trac metadata
Trac field Value
Version 8.2.1
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