Illegal instruction in GHC 6.5 generated code.
Simon Marlow
simonmar at microsoft.com
Mon Jun 26 06:27:38 EDT 2006
On 23 June 2006 17:43, Caio Marcelo wrote:
> On 6/23/06, Simon Marlow <simonmarhaskell at gmail.com> wrote:
>> What did I do wrong?
>
> Did you changed the Judy/Map.hs code to not use Dummy (see below)? The
> code I commited is the version with the workaround.
>
> Anyway, I'm going to darcs pull and recompile GHC to check if the
> behaviour changes.
>
> -----------8<------------
> Index: Judy/Map.hs
> ===================================================================
> --- Judy/Map.hs (revisão 10752)
> +++ Judy/Map.hs (cópia de trabalho)
> @@ -56,7 +56,8 @@
> class Dummy a
> instance Dummy a
>
> -instance Dummy a => Refeable a where
> +--instance Dummy a => Refeable a where
> +instance Refeable a where
> toRef a = do
> a' <- newStablePtr a
> return (ptrToWordPtr (castStablePtrToPtr a'))
> ---------->8-------------
Ok, I reproduced it. I think this may be a bug in your code, but I'm not completely sure.
Compiling the program with -debug turns the crash into an assertion failure. Furthermore, running the program with +RTS -DS, which causes all free memory to be filled with 0xaaaaaaaa, turns the crash into this:
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 47963533074768 (LWP 15726)]
0x0000003fa1e75b30 in memcpy () from /lib64/libc.so.6
(gdb) where
#0 0x0000003fa1e75b30 in memcpy () from /lib64/libc.so.6
#1 0x000000000045329e in JudyHSIterFirst (PArray=0x0, PPIter=Variable "PPIter" is not available.
) at JudyHS.c:983
#2 0x000000000040e2b1 in s2KX_info ()
#3 0x000000000066fb90 in ?? ()
#4 0x00002b9f616828d0 in ?? ()
#5 0x0000000000000000 in ?? ()
which looks suspicious. Delving a little further:
(gdb) up
#1 0x000000000045329e in JudyHSIterFirst (PArray=0x0, PPIter=Variable "PPIter" is not available.
) at JudyHS.c:983
983 memcpy(PIter->hsi_String, String, Length);
(gdb) p *PIter
$1 = {hsi_Alloc = 32, hsi_MaxLength = 0, hsi_Length = 12297829382473034410,
hsi_Hash = 0, hsi_String = "\000\000\000\000\000\000\000"}
(gdb) p String
$2 = (uint8_t *) 0xaaaaaaaaaaaaaaaa <Address 0xaaaaaaaaaaaaaaaa out of bounds>
(gdb) p Length
$3 = 12297829382473034410
So it looks like you're passing some free memory to a foreign function, perhaps. Is this any help?
Cheers,
Simon
More information about the Glasgow-haskell-users
mailing list