id,summary,reporter,owner,description,type,status,priority,milestone,component,version,resolution,keywords,cc,os,architecture,failure,difficulty,testcase,blockedby,blocking,related
7185,Compiled program crashes,waldheinz,simonmar,"I have a program which compiles fine, but the resulting executable crashes. First the steps to reproduce:

{{{
git clone git@github.com:waldheinz/bling.git
git checkout e2bad3ca6be2409386d28796997709318cf6ff64
cabal configure
cabal build
./dist/build/bling/bling examples/cornell-box-underwater.bling
}}}

This will result in either a segfault or produce an ""internal error"" message, at least for me and two other who tried it as well. The error message is

{{{
bling: internal error: scavenge_one: strange object -1083673327
    (GHC version 7.7.20120823 for x86_64_unknown_linux)
}}}

The ""strange object"" varies. Some random observations which might be useful:

  * this happens with GHC 7.4.1 and a fresh compile of HEAD (GHC version 7.7.20120823)
  * I sanitized the code to be completely free of unsafe* function calls. Before, there was quite some unsafe array reading/writing using the vector package. This did not change anything, but the revision above reflects this ""safe"" state, just in case...
  * the problem first occured when I change the SPPM.mkHash function to use the Utils.GrowVec type instead of lists for it's intermediate results. [1] GrowVec is basically a wrapper around a vector which doubles the size when space is exhausted. 
  * the optimization level does not seem to affect the problem (it occurs even with -O0 and everything else removed)

Running under GDB gives this stack trace: 

{{{
#1  0x00000031d12370d8 in abort () from /lib64/libc.so.6
#2  0x0000000000cb4765 in rtsFatalInternalErrorFn ()
#3  0x0000000000cb48dd in barf ()
#4  0x0000000000cd30e9 in scavenge_one ()
#5  0x0000000000cd3645 in scavenge_mutable_list ()
#6  0x0000000000cd3835 in scavenge_capability_mut_lists ()
#7  0x0000000000cb98bc in GarbageCollect ()
#8  0x0000000000cac043 in scheduleDoGC.isra.20 ()
#9  0x0000000000cacabf in scheduleWaitThread ()
#10 0x0000000000cb683e in real_main ()
#11 0x0000000000cb693a in hs_main ()
#12 0x0000000000407003 in main ()
}}}

I'm currently trying to debug this further, but my abilities on this front are limited...

[1] https://github.com/waldheinz/bling/commit/e1dc7b3c7e66cdd21a5aa46f9f96ca9448c52407#commitcomment-1761893",bug,closed,high,7.6.1,Compiler,7.4.1,fixed,,,Linux,x86_64 (amd64),Runtime crash,Unknown,,,,
