Skip to content

LLVM: Vector code segfaults under OSX

The following code:

import Data.Vector.Unboxed as V

main = foo 0 `seq` return ()

foo :: Int -> Vector Int
foo n = V.zipWith (\i j -> if i == j then 0 else 1)
              (V.replicate n 0) (V.enumFromTo 0 (n - 1))

Segfaults under OSX when compiled with GHC HEAD with the following flags:

ghc -fllvm -O2 -optlc-O3 --make v.hs

The problem only occurs when ghc is set to -O2 and llc is set to -O3. (opt tools optimisation level doesn't seem to matter).

The problem also only occurs when TNTC is enabled.

Trac metadata
Trac field Value
Version 6.13
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler (LLVM)
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information