MLton segfault on Linux!

Stephen Weeks MLton@sourcelight.com
Mon, 21 May 2001 14:54:57 -0700 (PDT)


> I'm very proud to have written an ML
> program which makes a segfault when compiled
> with MLton on Linux! :)

I think your bug is one that was fixed on 1999-8-13, and has been fixed in all
versions of MLton since then.  The problem is in the
MLTON_allocArrayNoPointers macro in mlton-lib.h.  Replace it with the following
to see if this corrects the problem.  Let us know if this works.

#define MLTON_allocArrayNoPointers(dst,numElts,bytesPerElt)			\
		*(word*)frontier = (numElts);					\
		*(word*)(frontier + WORD_SIZE) = 				\
			GC_arrayHeader((bytesPerElt), 0);			\
		(dst) = frontier + 2 * WORD_SIZE; 				\
		frontier = (dst) + ((0 == numElts || 0 == bytesPerElt) 		\
			? POINTER_SIZE :					\
			wordAlign((numElts) * (bytesPerElt)));