strange behavior of ":i"

Sigbjorn Finne sof@galois.com
Mon, 7 Jan 2002 16:37:36 -0800


Thanks, bugs now fixed. The more serious one caused me
to learn the hard way about an invariant that must hold for
the names/tycons info the interpreter maintains on a per-module
basis. The Dec 2001 release is not affected by this.

--sigbjorn

----- Original Message ----- 
From: "Levent Erkok" <erkok@cse.ogi.edu>
To: <hugs-bugs@haskell.org>
Sent: Sunday, January 06, 2002 15:52
Subject: strange behavior of ":i"


> Hugs version: Out of the CVS repository.
> 
> Load this file: (the syntax error is intentional.)
> ----------------------------------------------------
> import IO
>  
> x=
> ----------------------------------------------------
> 
> After Hugs complains that there's an error (rightly
> so), type this:
> 
> ----------------------------------------------------
> IO> :i IORef      
> ----------------------------------------------------
> 
> Hugs goes into an infinite loop.
> 
> I've looked at the code a bit. It dies down in the call
> to findName, on line 1810 of hugs.c. This call never
> returns.
> 
> Also, two if statements on lines 1797 and 1798 of hugs.c
> look suspicious:
> 
>    if (!mod) { free(mod); mod = NULL; }          
>    if (!nm)  { free(nm);  nm  = NULL; }
> 
> Looks like the tests are inverted. (The above bug is not 
> caused by this, even when I remove the !'s, it still goes 
> into an infinite loop.)
> 
> I've tried compiling after setting WANT_FIXED_SIZE_TABLES
> to 1 in prelude.h, but still the same.
> 
> What's strange is that I can't repeat the bug using any 
> other import (i.e. anything other than IO), or without 
> causing a syntax error in the file. Really weird.
> 
> -Levent.
>