[GHC] #12227: regression: out of memory with -O2 -ddump-hi on a complex INLINE function
GHC
ghc-devs at haskell.org
Thu Jun 23 21:22:09 UTC 2016
#12227: regression: out of memory with -O2 -ddump-hi on a complex INLINE function
-------------------------------------+-------------------------------------
Reporter: j6carey | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.0.1
(CodeGen) |
Keywords: | Operating System: Linux
Architecture: x86_64 | Type of failure: None/Unknown
(amd64) |
Test Case: | Blocked By:
Blocking: | Related Tickets:
Differential Rev(s): | Wiki Page:
-------------------------------------+-------------------------------------
Summary:
Unlike GHC 7.10.2, when GHC 8.0.1 tries to compile a certain complex
INLINE function with -O2 -ddump-hi, it runs out of memory. Dropping
either -O2 or -ddump-hi enables successful compilation.
Oddly enough, triggering the issue requires using the function argument
indirectly through a variable bound by a "where" clause, even though it is
obvious to a human reader that the indirection is trivial.
(Even after simplifying the original code to work around the out of memory
issue, that indirection greatly increases the size of the ".dump-hi" file.
It might be that the "out of memory" would not happen if one had
sufficient RAM.)
Using INLINABLE instead of INLINE seems to result in a much smaller RHS
being recorded for the function in question, and does not trigger the
problem. (Perhaps INLINABLE records a more optimized RHS than does
INLINE, though that is not obvious to me from the GHC User's Guide.)
The attached files contain a reduced version of the original code that
still triggers the problem. (Of course, the reduced version is rather
artificial and pointless, other than to demonstrate the problem.)
Probably someone with sufficient understanding could shrink the example
further.
Please note that I have worked around the issue, and so I am not blocked
by this problem, at least not currently.
Attachments:
- crash.bash
- Crash.hs
Observed behavior:
On 64-bit x86 Ubuntu 16.04 LTS, with the attached files in the current
directory, GHC 7.10.2 succeeds:
{{{
$ ./crash.bash
The Glorious Glasgow Haskell Compilation System, version 7.10.2
[1 of 1] Compiling Crash ( Crash.hs, Crash.o )
}}}
whereas GHC 8.0.1 runs out of memory (or wedges my system if I comment out
both "ulimit" commands in the script):
{{{
$ ./crash.bash
The Glorious Glasgow Haskell Compilation System, version 8.0.1
[1 of 1] Compiling Crash ( Crash.hs, Crash.o )
ghc: out of memory
}}}
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12227>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list