# [Haskell-cafe] Compiler stops at SpecConstr optimization

Daniel Díaz Casanueva dhelta.diaz at gmail.com
Thu Aug 29 18:38:48 CEST 2013

```Hello.

While hacking in one of my projects, one of my modules stopped to compile
for apparently no reason. The compiler just freezes (like if it where in an
infinite loop) while trying to compile that particular module. Since I had
this problem I have been trying to reduce the problem as much as I could,
and I came out with this small piece of code:

> module Blah (foo) where

> import Data.Vector (Vector)
> import qualified Data.Vector as V

> foo :: (a -> a) -> Vector a -> Vector a
> foo f = V.fromList . V.foldl (\xs x -> f x : xs) []

The module I am importing comes from package vector-0.10.0.1. The compiler
I am using is ghc-7.6.3. The problem arises when compiling using the
following flags:

ghc Blah.hs -O1 -fspec-constr

If I compile it verbosely (with -v), I can see that the compiler stops in
the SpecConstr optimization step. I have tried to reduce the -O1 flag to a
particular set of flags, but I didn't manage yet to find the complete set
of flags that -O1 translates to (optLevelFlags [1] seems to give not enough
information).

Since this problem can be OS-dependent, my system is Debian 7 and I didn't
try yet to reproduce my problem in other systems (mainly because I don't
have access to other systems at the moment).

I am posting this here to, with the help of the Haskell Community, check
first if this is indeed a bug and, in such case, to find out where that bug
comes from (GHC, vector library, something else?). Then, if necessary, I
would write a bug report where appropriate.

Thank you,
Daniel Díaz.

-- References

[1] -
https://github.com/ghc/ghc/blob/ghc-7.6.3-release/compiler/main/DynFlags.hs#L2266
-------------- next part --------------
An HTML attachment was scrubbed...