Ticket #1993 (closed bug: duplicate)

Opened 5 years ago

Last modified 4 years ago

"RegAllocLinear.getStackSlotFor: out of stack slots" when compiling SHA1.hs in darcs

Reported by: apstrand Owned by:
Priority: normal Milestone: 6.10 branch
Component: Compiler (NCG) Version: 6.8.2
Keywords: Cc: tom.davie@…
Operating System: Unknown/Multiple Architecture: x86
Type of failure: Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets:

Description (last modified by igloo) (diff)

I got the following error when compiling darcs under win32/cygwin with ghc 6.8.2 and profiling turned on.

$ make VERBOSE=1
ghc -DPACKAGE_NAME=\"darcs\" -DPACKAGE_TARNAME=\"darcs\" -DPACKAGE_VERSION=\"2.0.0pre3\" -DPACKAGE_STRING=\"darcs\ 2.0.0pre3\" -DPACKAGE_BUGREPORT=\"bugs@darcs.net\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -Isrc/win32 -cpp  -package regex-compat -package QuickCheck -package mtl -package parsec -package html -package containers -package pretty -O -funbox-strict-fields  -prof -auto-all -Wall -Werror -I. -I./src -i./src -isrc/win32 -Isrc/win32 -DWIN32
-DHAVE_MAPI -no-auto-all -funfolding-use-threshold20 -c src/SHA1.lhs
ghc.exe: panic! (the 'impossible' happened)
  (GHC version 6.8.2 for i386-unknown-mingw32):
        RegAllocLinear.getStackSlotFor: out of stack slots

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

make: *** [src/SHA1.o] Error 1

Context for the darcs version I tried to compile is attached.

Attachments

darcs.context Download (1.7 KB) - added by apstrand 5 years ago.
Darcs version
SHA1.lhs Download (10.2 KB) - added by igloo 5 years ago.
Standalone example

Change History

Changed 5 years ago by apstrand

Darcs version

Changed 5 years ago by apstrand

  • os changed from Unknown to Windows
  • architecture changed from Unknown to x86

Changed 5 years ago by igloo

  • description modified (diff)

Changed 5 years ago by igloo

Standalone example

Changed 5 years ago by igloo

  • milestone set to 6.8.3

I've added a standalone example:

$ ghc -O -funbox-strict-fields -prof -funfolding-use-threshold20 -c SHA1.lhs
ghc.exe: panic! (the 'impossible' happened)
  (GHC version 6.8.2 for i386-unknown-mingw32):
        RegAllocLinear.getStackSlotFor: out of stack slots

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

Changed 5 years ago by simonmar

  • component changed from Compiler to Compiler (NCG)
  • milestone changed from 6.8.3 to 6.10 branch

I'm curious as to whether this is new or not (I suspect not). The SHA1 code is known to be a good stress test for the register allocator, in fact Ben Lippmeier used it extensively while developing the new register allocator.

You can work around the problem with -fregs-graph (to enable the new graph-colouring register allocator).

What's happening is the register allocator is exhausting the fixed number of spill slots we have; and there are currently 8k's worth. It doesn't re-use spill slots, which is one bug, but also there are no optimisations that attempt to reduce register pressue, which could be considered another bug.

Given that we want to concentrate efforts on the new allocator, and we have a workaround for this issue, I don't think it's worth investing significant time in fixing the old register allocator, so I'm moving the milestone to 6.10.

Changed 5 years ago by alatter

using the attached file:

{{{$ ghc -O -funbox-strict-fields -prof -funfolding-use-threshold20 -c SHA1.lhs -fregs-graph +RTS -K10M ghc-6.9.20080126: panic! (the 'impossible' happened)

(GHC version 6.9.20080126 for i386-unknown-linux):

regSpill: out of spill slots!

regs to spill = 814 slots left = 677

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

The +RTS -K10M is needed to prevent stack overflow.

Changed 5 years ago by guest

  • cc tom.davie@… added
  • os changed from Windows to Multiple

Duplicated on Ubuntu 8.04 (32 bit intel), with ghc6.9.20080615. No -prof was used -- just bailed during compiling darcs-2.0.2.

-fregs-graph produced a stack overflow message +RTS -K10M produced the error noted by alatter.

Changed 5 years ago by simonmar

  • os changed from Multiple to Unknown/Multiple

Changed 4 years ago by igloo

  • status changed from new to closed
  • resolution set to duplicate

Closing in favour of #2790.

Note: See TracTickets for help on using tickets.