Opened 13 months ago

Last modified 12 months ago

#13956 infoneeded bug

ghc panic compiling lame-0.1.1

Reported by: uznx Owned by:
Priority: normal Milestone: 8.2.2
Component: Compiler Version: 8.2.1-rc3
Keywords: Cc:
Operating System: Linux Architecture: x86_64 (amd64)
Type of failure: Compile-time crash or panic Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description (last modified by bgamari)

Compiling the package lame-0.1.1 using cabal, with profiling:

[2 of 2] Compiling Codec.Audio.LAME ( Codec/Audio/LAME.hs, dist/build/Codec/Audio/LAME.p_o )
ghc: panic! (the 'impossible' happened)
  (GHC version 8.2.0.20170704 for x86_64-unknown-linux):
        Simplifier ticks exhausted
  When trying UnfoldingDone lvl_soT9
  To increase the limit, use -fsimpl-tick-factor=N (default 100)
  If you need to do this, let GHC HQ know, and what factor you needed
  To see detailed counts use -ddump-simpl-stats
  Total ticks: 504681
  Call stack:
      CallStack (from HasCallStack):
        prettyCurrentCallStack, called at compiler/utils/Outputable.hs:1133:58 in ghc:Outputable
        callStackDoc, called at compiler/utils/Outputable.hs:1137:37 in ghc:Outputable
        pprPanic, called at compiler/simplCore/SimplMonad.hs:199:31 in ghc:SimplMonad

Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug

This is a regression; the package compiles fine with GHC 8.0.2

Change History (5)

comment:1 Changed 13 months ago by bgamari

Description: modified (diff)
Milestone: 8.2.2

Hmm, indeed this is quite bad: even a tick factor of 10000 doesn't finish (despite taking at least 10GB of memory before I killed it).

It appears that it is looping on a set of inlinings. -ddump-inlinings says,

...
Inlining done: Data.Text.$fEqText_$c==
Inlining done: Codec.Audio.LAME.Internal.id3TagSetAlbumArt1
Inlining done: Codec.Audio.LAME.Internal.setBitrate1
Inlining done: Codec.Audio.LAME.Internal.setCompressionRatio1
Inlining done: Codec.Audio.LAME.Internal.id3TagSetAlbumArt1
Inlining done: Codec.Audio.LAME.Internal.setBitrate1
Inlining done: Codec.Audio.LAME.Internal.setCompressionRatio1
Inlining done: Codec.Audio.LAME.Internal.id3TagSetAlbumArt1
Inlining done: Codec.Audio.LAME.Internal.setBitrate1
Inlining done: Codec.Audio.LAME.Internal.setCompressionRatio1
...

comment:2 Changed 13 months ago by bgamari

This appears to be due to b8f58d79ee3e34840beeea2fab846a9f47bff21a,

b8f58d79ee3e34840beeea2fab846a9f47bff21a is the first bad commit
commit b8f58d79ee3e34840beeea2fab846a9f47bff21a
Author: Simon Peyton Jones <simonpj@microsoft.com>
Date:   Fri Dec 23 14:17:42 2016 +0000

    Another improvement to SetLevels
    
    In my recent commit
       commit 432f952ef64641be9f32152a0fbf2b8496d8fe9c
       Float unboxed expressions by boxing
    I changed how float_me in lvlMFE worked.  That was right, but
    it exposed another bug: an error expression wasn't getting floated
    as it should from a case alternative.  And that led to a collection
    of minor improvements
Last edited 13 months ago by bgamari (previous) (diff)

comment:3 Changed 13 months ago by bgamari

For future reference, the issue can be reproduced with lame-0.1.1 with,

ghc -dumpdir bad -fforce-recomp -dverbose-core2core -ddump-ds Codec/Audio/LAME -ddump-to-file -prof -fprof-auto-exported 

comment:4 Changed 13 months ago by bgamari

More complete reproduction instructions,

$ cabal unpack lame==0.1.1
$ cd lame-0.1.1
$ cabal install --only-dependencies --enable-library-profiling
$ ghc Codec/Audio/LAME -prof -fprof-auto-exported 
Last edited 12 months ago by bgamari (previous) (diff)

comment:5 Changed 12 months ago by bgamari

Status: newinfoneeded

Unfortunately I can no longer reproduce this with the final GHC 8.2.1 release. Codec.Audio.LAME seems to compile with profiling in around 3 seconds with rather reasonable memory usage on my laptop. This is admittedly a bit surprising as there weren't many relevant changes between -rc3 and final.

uznx, can you confirm that this is fixed?

Note: See TracTickets for help on using tickets.