Opened 9 years ago

Closed 9 years ago

#2753 closed bug (duplicate)

GHC 6.10.1 cannot compile Crypto-4.1.0

Reported by: thoughtpolice Owned by:
Priority: normal Milestone: 6.10.2
Component: Compiler Version: 6.10.1
Keywords: Cc: sk@…, gwern0@…, liesen, awick
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


While trying to install Crypto, I get this error message with GHC 6.10.1 on Mac OS X 10.5:

$ cabal install Crypto
Linking dist/build/SymmetricTest/SymmetricTest ...
[1 of 4] Compiling Codec.Utils      ( Codec/Utils.hs, dist/build/SHA1Test/SHA1Test-tmp/Codec/Utils.o )
[2 of 4] Compiling Data.Digest.SHA1 ( Data/Digest/SHA1.hs, dist/build/SHA1Test/SHA1Test-tmp/Data/Digest/SHA1.o )
[3 of 4] Compiling Codec.Text.Raw   ( Codec/Text/Raw.hs, dist/build/SHA1Test/SHA1Test-tmp/Codec/Text/Raw.o )
[4 of 4] Compiling Main             ( SHA1Test.hs, dist/build/SHA1Test/SHA1Test-tmp/Main.o )

ghc: panic! (the 'impossible' happened)
  (GHC version 6.10.1 for i386-apple-darwin):
	RegAllocLinear.getStackSlotFor: out of stack slots, try -fregs-graph


Even with -fregs-graph specified (in the .cabal file) this happens.

Change History (12)

comment:1 Changed 9 years ago by thoughtpolice

Actually, with -fregs-graph it does build (got cabal file wrong.) But without it this chokes on the SHA1Test.hs file.

comment:2 Changed 9 years ago by JohnMacFarlane

I'm getting the same problem on a Ubuntu linux x86 system. See also #2623.

comment:3 Changed 9 years ago by nominolo

SHA1 is a particular stress-test of the register allocator. It's a known problem, but apparently #2623 claims it's been fixed. So perhaps #2623 should be re-opened and this one be marked as a duplicate.

comment:4 Changed 9 years ago by simonmar

difficulty: Unknown
Milestone: 6.10.2
Operating System: MacOS XUnknown/Multiple

I don't think it was ever fixed, it may have just stopped happening for a while for unrelated reasons.

The problem is that the spill code in the linear register allocator is pretty stupid and doesn't try to re-use spill slots. Also, we only have a fixed number of spill slots, because we have a fixed-size frame on the C stack in which to spill into, which is currently 2048 words. We could certainly bump the size of this without any serious adverse effects (includes/Constants.h, RESERVED_C_STACK_BYTES). I suggest that as a workaround for 6.10.2.

comment:5 Changed 9 years ago by gregwebs

On debian Linux X86 ghc 6.10.1 I encountered this problem. I was able to compile by modifying the cabal file to use -fregs-graph.

 Executable      SHA1Test
  Main-Is:         SHA1Test.hs
  Ghc-options:     -fregs-graph
  Other-modules:   Codec.Text.Raw

comment:6 Changed 9 years ago by igloo

Oh, for some reason I thought that -fregs-graph was the default in 6.10, which was why it worked in the past. Is there a reason not to make it the default?

comment:7 in reply to:  6 Changed 9 years ago by simonmar

Replying to igloo:

Oh, for some reason I thought that -fregs-graph was the default in 6.10, which was why it worked in the past. Is there a reason not to make it the default?

Partly paranoia: the linear-scan allocator has had a good shakedown, it only has two known bugs (this one and another one that doesn't actually show up in practice), whereas -fregs-graph has hardly been tested in the field. Partly performance: I believe -fregs-graph is slower, but we haven't measured it systematically yet. We'll probably want -fregs-graph to become the default in 6.12, however. I'm still considering whether we want to keep the old allocator around too, perhaps for non-optimised compilations.

comment:8 Changed 9 years ago by StefanKersten

Cc: sk@… added

comment:9 Changed 9 years ago by guest

Cc: gwern0@… added

Just to chip in: i386 Intrepid Ubuntu, GHC HQ's 6.10 binaries, darcs Crypto.

Adding the -freg-graphs option to the sha1test stanza fixed the compilation problem for me.

comment:10 Changed 9 years ago by liesen

Cc: liesen added

comment:11 Changed 9 years ago by awick

Cc: awick added

comment:12 Changed 9 years ago by igloo

Resolution: duplicate
Status: newclosed

Closing in favour of #2790.

Note: See TracTickets for help on using tickets.