GHC fails to terminate while compiling with optimization level 2
When I try to compile random-fu-0.2.4.0 from Hackage, using the command:
cabal install --ghc --ghc-options="-fllvm -O2 -dcore-lint" --enable-optimization=2 random-fu-0.2.4.0
I get the following output:
Resolving dependencies...
Configuring random-fu-0.2.4.0...
Building random-fu-0.2.4.0...
Preprocessing library random-fu-0.2.4.0...
[ 1 of 27] Compiling Data.Random.Internal.Find ( src/Data/Random/Internal/Find.hs, dist/build/Data/Random/Internal/Find.o )
[ 2 of 27] Compiling Data.Random.Internal.Fixed ( src/Data/Random/Internal/Fixed.hs, dist/build/Data/Random/Internal/Fixed.o )
[ 3 of 27] Compiling Data.Random.Internal.TH ( src/Data/Random/Internal/TH.hs, dist/build/Data/Random/Internal/TH.o )
[ 4 of 27] Compiling Data.Random.Lift ( src/Data/Random/Lift.hs, dist/build/Data/Random/Lift.o )
[ 5 of 27] Compiling Data.Random.RVar ( src/Data/Random/RVar.hs, dist/build/Data/Random/RVar.o )
[ 6 of 27] Compiling Data.Random.Distribution ( src/Data/Random/Distribution.hs, dist/build/Data/Random/Distribution.o )
[ 7 of 27] Compiling Data.Random.Distribution.Uniform ( src/Data/Random/Distribution/Uniform.hs, dist/build/Data/Random/Distribution/Uniform.o )
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading package transformers-0.3.0.0 ... linking ... done.
Loading package mtl-2.1.2 ... linking ... done.
Loading package MonadPrompt-1.0.0.3 ... linking ... done.
Loading package array-0.4.0.1 ... linking ... done.
Loading package deepseq-1.3.0.1 ... linking ... done.
Loading package containers-0.5.0.0 ... linking ... done.
Loading package pretty-1.1.1.0 ... linking ... done.
Loading package template-haskell ... linking ... done.
Loading package syb-0.4.0 ... linking ... done.
Loading package th-extras-0.0.0.2 ... linking ... done.
Loading package flexible-defaults-0.0.1.1 ... linking ... done.
Loading package old-locale-1.0.0.5 ... linking ... done.
Loading package old-time-1.1.0.1 ... linking ... done.
Loading package time-1.4.0.1 ... linking ... done.
Loading package random-1.0.1.1 ... linking ... done.
Loading package mersenne-random-pure64-0.2.0.3 ... linking ... done.
Loading package primitive-0.5.0.1 ... linking ... done.
Loading package vector-0.10.0.1 ... linking ... done.
Loading package mwc-random-0.12.0.1 ... linking ... done.
Loading package stm-2.4.2 ... linking ... done.
Loading package stateref-0.3 ... linking ... done.
Loading package random-source-0.3.0.4 ... linking ... done.
Loading package rvar-0.2.0.1 ... linking ... done.
Loading package MonadRandom-0.1.9 ... linking ... done.
Loading package random-shuffle-0.0.4 ... linking ... done.
Loading package monad-loops-0.4.2 ... linking ... done.
Loading package continued-fractions-0.9.1.1 ... linking ... done.
Loading package converge-0.1.0.1 ... linking ... done.
Loading package gamma-0.9.0.2 ... linking ... done.
Loading package erf-2.0.0.0 ... linking ... done.
[ 8 of 27] Compiling Data.Random.List ( src/Data/Random/List.hs, dist/build/Data/Random/List.o )
[ 9 of 27] Compiling Data.Random.Distribution.Bernoulli ( src/Data/Random/Distribution/Bernoulli.hs, dist/build/Data/Random/Distribution/Bernoulli.o )
[10 of 27] Compiling Data.Random.Distribution.Categorical ( src/Data/Random/Distribution/Categorical.hs, dist/build/Data/Random/Distribution/Categorical.o )
*** Core Lint warnings : in result of Desugar (after optimization) ***
<no location info>: Warning:
[RHS of $c>>_aMYc :: forall p_aMMn.
GHC.Num.Num p_aMMn =>
forall a_a3Jr b_a3Js.
Data.Random.Distribution.Categorical.Categorical p_aMMn a_a3Jr
-> Data.Random.Distribution.Categorical.Categorical p_aMMn b_a3Js
-> Data.Random.Distribution.Categorical.Categorical p_aMMn b_a3Js]
INLINE binder is (non-rule) loop breaker: $c>>_aMYc
It then freezes for an as-far-as-I-known indefinite amount of time; I have tried it several times, and it never moves beyond that. Once, I left it for two whole hours without any change. Every time, I have had to manually interrupt it with ctrl-c
.
On the other hand, if I instead use the command:
cabal install --ghc --ghc-options="-fllvm -O1 -dcore-lint" --enable-optimization=1 random-fu-0.2.4.0
It produces literally identitical output up to the point that the first command stopped at, but it continues as normal afterwards and finishes installing random-fu as expected.
My terminal confirms that the ghc
executable (as opposed to, say, opt
or llc
) is the one that the first command gets stuck on.
Trac metadata
Trac field | Value |
---|---|
Version | 7.6.3 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |