Skip to content

<<loop>> in withMVar (reproducible, but with large test case)

A user of one of my libraries is reporting that it fails with the message <<loop>> when compiled in GHC 7.2.1. The error is coming from withMVar, and is reproducible.

Unfortunately, the problem is *very* tricky to reproduce. Attempting to debug it (such as adding print statements, re-ordering operations, or removing unrelated code) will cause it to vanish. Therefore, the test case I have attached is a full Cabal project with build instructions. Nearly every line of code is required, and changing or removing them hides the error again.

Changes which can hide the problem:

  • Altering or removing the startup messages (even the version number).
  • Removing unused attributes from types.
  • Removing unused error checking.
  • Using _ <- char 'a' instead of void (char 'a').
  • Moving a function from one module to another.
  • Simplifying loops which only run over one element.
  • Building it all at once with --make, and not a separate cabal-dev install step.
  • Building 'Main' with -O2.
Edited by Ian Lynagh -
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information