[MLton-user] MLton-20051202 crashes on Cygwin

Tom Murphy twm@andrew.cmu.edu
Sun, 14 May 2006 16:01:47 -0400


I have seen a problem like this before on linux. The issue was that the 
mlton-produced binary we were running was linked against a version of 
GMP that was compiled for a different processor. To my understanding GMP 
tries to use lots of processor extensions for better performance, but 
this makes the binaries not very portable. We fixed it by using a libgmp 
compiled on an older machine instead. Since I expect mlton itself 
doesn't do much IntInf crunching, perhaps it should be linked against a 
more conservative GMP?

  Tom

My system:

bash-3.00$ cat /proc/cpuinfo
processor       : 0
vendor_id       : AuthenticAMD
type            : primary processor
cpu family      : 6
model           : 10
model name      : AMD Athlon(tm) XP 2500+
stepping        : 0
brand id        : 0
cpu count       : 0
apic id         : 0
cpu MHz         : 1829
fpu             : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge 
mca cmov
pat pse36 mmx fxsr sse syscall mmxext 3dnowext 3dnow

Ville Laurikari wrote:
> Hi,
> 
> For me, any attempt to run MLton on Cygwin (latest stable) ends up in
> a crash with "Illegal instruction".  
> 
> It would seem that the crash happens at some early stage, probably
> during some initialization phase.   The actual crash seems to be
> happening in GMP code.
> 
> Has anyone else seen this?
> 
> Here's what I can think of showing about the crash:
> 
> $ gdb /usr/lib/mlton/mlton-compile 
> GNU gdb 6.3.50_2004-12-28-cvs (cygwin-special)
> Copyright 2004 Free Software Foundation, Inc.
> GDB is free software, covered by the GNU General Public License, and
> you are
> welcome to change it and/or distribute copies of it under certain
> conditions.
> Type "show copying" to see the conditions.
> There is absolutely no warranty for GDB.  Type "show warranty" for
> details.
> This GDB was configured as "i686-pc-cygwin"...
> (gdb) run
> Starting program: /usr/lib/mlton/mlton-compile 
> 
> Program received signal SIGILL, Illegal instruction.
> __gmpn_mul_1 () at tmp-mul_1.s:88
> 88      tmp-mul_1.s: No such file or directory.
>         in tmp-mul_1.s
> Current language:  auto; currently asm
> (gdb) bt
> #0  __gmpn_mul_1 () at tmp-mul_1.s:88
> #1  0x00d35d64 in __gmpn_set_str (rp=0xa, str=0xffffffff <Address 0xffffffff out of bounds>, 
>     str_len=2089917163, base=2089917344) at set_str.c:177
> #2  0x00000006 in ?? ()
> #3  0x19870000 in ?? ()
> #4  0x00f1a1d0 in localInt64 ()
> #5  0x00d356c0 in mmapAnon ()
> #6  0x00000000 in ?? () from 
> (gdb) info locals
> No locals.
> (gdb) up 1
> #1  0x00d35d64 in __gmpn_set_str (rp=0xa, str=0xffffffff <Address 0xffffffff out of bounds>, 
>     str_len=2089917163, base=2089917344) at set_str.c:177
> 177     set_str.c: No such file or directory.
>         in set_str.c
> Current language:  auto; currently c
> (gdb) info locals
> i = 10
> j = 1
> cy_limb = 426704916
> size = 15835600
> big_base = 10
> chars_per_limb = 9
> res_digit = 426704912
> str = (const unsigned char *) 0x196f0022 ""
> base = 10
> (gdb) quit
> The program is running.  Exit anyway? (y or n) y
> 
> ville@redundant ~
> $ cat /proc/cpuinfo 
> processor       : 0
> vendor_id       : AuthenticAMD
> type            : primary processor
> cpu family      : 6
> model           : 8
> model name      : AMD Athlon(tm) XP 2700+
> stepping        : 1
> brand id        : 0
> cpu count       : 0
> apic id         : 0
> cpu MHz         : 2171
> fpu             : yes
> flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge
> mca cmov pat pse36 mmx fxsr sse syscall mmxext 3dnowext 3dnow
> 
>