GHCi Segmentation fault/access violation in generated code
GHCi crashes with the error message Segmentation fault/access violation in generated code
. The problem arises when trying to use the Haskell Tools project from GHCi. The program can be successfully compiled with the ghc compiler.
The cause of this behavior is that there are elements thats type is computed by a type family application. When I changed the representation to eliminate these, the problem was gone.
I can turn the problem on and off only by adding an import or removing it. To solve the problem simply comment out the modules that use the information with the complex calculated type, as done in the attached diff.
To try out use a minimal program:
module Main where
import Language.Haskell.Tools.Refactor
main = demoRefactor "" "." "A"
Execute the ghci -package ghc -isrc\ast;src\ast-ghc;sr c\ast-trf;src\ast-ppr;src\ast-gen;src\refactor;src Main
command from the project root.
That will search for a simple A.hs
file in the working directory. A minimalistic module is enough to trigger the problem:
module A where
PS: I tried to create a smaller example, but the problem just appears and disappears without "reason" when I try to modify the code. (For example importing a module that is not actually used.)
Trac metadata
Trac field | Value |
---|---|
Version | 8.0.1 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | GHCi |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |