Crashing Hugs for fun and profit
Hi I've attached 3 separate bugs in the Hugs compiler, they are all a bit perplexing, and all seem to ruffle similar areas. I suspect there is an underlying memory bug, such as overwriting areas of memory or something. * Silly fails to derive something that should be obvious, as sent in a previous mail to hugs-users@ * Nonterm generates:
hugs Nonterm.hs -98
ERROR "Nonterm.hs":56 - Unresolved top-level overloading *** Binding : test *** Outstanding context : (Play b, Typeable b, Play ((bad type) ((bad type) ((ba d type) ((bad type) (bad type)))) ((bad type) ((bad type) ((bad type) ((bad type ) ((bad type) ((bad type) ((bad type) (bad type)))) ((bad type) ((bad type) ((ba Running with WinHugs causes an immediate shutdown. * Segfault generates:
hugs Segfault.hs -98
Unexpected signal With WinHugs I get an immediate shutdown. Thanks Neil
On Fri, Apr 20, 2007 at 01:42:52AM +0100, Neil Mitchell wrote:
* Nonterm generates:
hugs Nonterm.hs -98
ERROR "Nonterm.hs":56 - Unresolved top-level overloading *** Binding : test *** Outstanding context : (Play b, Typeable b, Play ((bad type) ((bad type) ((ba d type) ((bad type) (bad type)))) ((bad type) ((bad type) ((bad type) ((bad type ) ((bad type) ((bad type) ((bad type) (bad type)))) ((bad type) ((bad type) ((ba
Running with WinHugs causes an immediate shutdown.
* Segfault generates:
hugs Segfault.hs -98
Unexpected signal
With WinHugs I get an immediate shutdown.
Under Linux, I get "Garbage collection fails to reclaim sufficient space" for both of these.
Ross
* Nonterm generates:
* Segfault generates:
Under Linux, I get "Garbage collection fails to reclaim sufficient space" for both of these.
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 have replicated this on my other Windows machine, with the same binaries, and the same result. Perhaps running this example under Valgrind will show up something? Thanks Neil
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.
Hi
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.
Oh, I had no idea that optimisation was turned off for certain files - with the Windows build its turned on for all files. I guess if something is that sensitive to optimisation, the Windows compiler could be doing anything to it... Thanks Neil
participants (2)
-
Neil Mitchell -
Ross Paterson