Skip to content

stale .tix files can cause programs built with -fhpc to segfault

In some circumstances, programs built with -fhpc will segfault when old .tix files reference modules that no longer exist.

foo.hs

import Bar

main = print "Hello World"

Bar.hs

module Bar where

something = 1 :: Int
jwlato@compy:~/explorations$ ghc -O -fhpc foo.hs 
[1 of 2] Compiling Bar              ( Bar.hs, Bar.o )
[2 of 2] Compiling Main             ( foo.hs, foo.o )
Linking foo ...
jwlato@compy:~/explorations$ ./foo 
"Hello world"
jwlato@compy:~/explorations$ mv Bar.hs Bar.hs.orig
jwlato@compy:~/explorations$ sed -e 's/import/-- import/' -i.bak foo.hs 
jwlato@compy:~/explorations$ rm *.hi; rm *.o
jwlato@compy:~/explorations$ ghc -O -fhpc foo.hs 
[1 of 1] Compiling Main             ( foo.hs, foo.o )
Linking foo ...
jwlato@compy:~/explorations$ ./foo 
Segmentation fault

If "foo.hs" has a 'module Main where' declaration, instead of a segfault the program exits with a message that 'foo.tix' should be deleted.

Trac metadata
Trac field Value
Version 7.4.2
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Code Coverage
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