[MLton] MLton broken FFI on AMD64???

Henry Cejtin henry.cejtin at sbcglobal.net
Thu Feb 3 14:46:54 PST 2011


It  seems that either there is a new bug in the foreign function calling
sequence or something has changed.

I'm using the version of MLton in Debian testing:
    MLton 20100608 (built Tue Jun 15 01:10:03 UTC 2010 on barber)
on a Linux AMD64 architecture.

The following program segfaults when run:

    val printf = _import "printf": string * int -> unit;
    val () = printf ("You are a dog %d0000", 99)
    val () = printf ("Hello silly %d0000", 123)

It prints out the first line but then segfaults on the  second  call  to
printf.

I looked in
    /usr/share/doc/mlton/guide/CallingFromSMLToC
page  and  what  I'm  doing  looks  like it is following the description
there.


On Linux i386, this code works both using the Debian stable  version  of
MLton:
    MLton 20070826 (built Mon Sep 03 18:05:04 2007 on eponym)
and also a version I just built from the repository:
    MLton rexported (built Tue Feb  1 23:22:44 CST 2011 on jupiter)

I  thought  perhaps  it  was  something involving int vs. Int64.int, but
changing the printf type in the ML code to Int64.int made no  difference
on the AMD64 machine.

Any suggestions?



More information about the MLton mailing list