Crashing Hugs for fun and profit

Ross Paterson ross at soi.city.ac.uk
Fri Apr 20 09:41:31 EDT 2007


On Fri, Apr 20, 2007 at 01:44:15PM +0100, Neil Mitchell wrote:
> By tweaking the code a bit I was able to get GC messages, but the
> examples above crash. I suspect the crash is rather fragile - minor
> alternations like removing expressions that seemingly have no
> interaction fix this crash. I suspect it will be hard to replicate
> unless you use the actual binary from WinHugs.

I wonder if this is related to the reason that optimization is turned
off for certain files (search for "Modules to be compiled without
optimization" in src/Makefile.in).  During the static analysis and type
checking phases, the mark phase of the Hugs garbage collector also looks
for cells on the C stack (this is omitted during evaluation, because
all the primitives are carefully written to ensure that everything is
reachable from the Hugs stack).  Optimization may obscure these cell
references, which would certainly cause crashes.



More information about the Hugs-Bugs mailing list