<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:st1="urn:schemas-microsoft-com:office:smarttags" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]--><o:SmartTagType
 namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="PersonName"/>
<!--[if !mso]>
<style>
st1\:*{behavior:url(#default#ieooui) }
</style>
<![endif]-->
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
h1
        {mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:24.0pt;
        font-family:"Times New Roman";
        font-weight:bold;}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:blue;
        text-decoration:underline;}
p
        {mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman";}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:Arial;
        color:navy;}
@page Section1
        {size:595.3pt 841.9pt;
        margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.Section1
        {page:Section1;}
-->
</style>

</head>

<body lang=FR link=blue vlink=blue>

<div class=Section1>

<p class=MsoNormal><font size=3 face="Times New Roman"><span lang=EN-US
style='font-size:12.0pt'>Removing &#8211;lkernel32 does not solve the issue.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=3 face="Times New Roman"><span lang=EN-US
style='font-size:12.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=3 face="Times New Roman"><span lang=EN-US
style='font-size:12.0pt'>But I could workaround the issue anyway following your
other recommendation and replacing the local variable with a pointer and a
malloc().<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=3 face="Times New Roman"><span lang=EN-US
style='font-size:12.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=3 face="Times New Roman"><span lang=EN-US
style='font-size:12.0pt'>I could notice that Kai Tietz had submitted a patch &laquo;&nbsp;[patch
i386]: x86_64-pc-mingw _alloca and _stkchk may corrupts stack alignment<b><span
style='font-weight:bold'>&nbsp;&raquo;</span></b> which seems to be related to
the problem you mentionned&nbsp;:<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=3 face="Times New Roman"><span lang=EN-US
style='font-size:12.0pt'><a
href="http://gcc.gnu.org/ml/gcc-patches/2008-01/msg01350.html"><font size=2
face=Arial><span style='font-size:10.0pt;font-family:Arial'>http://gcc.gnu.org/ml/gcc-patches/2008-01/msg01350.html</span></font></a><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=3 face="Times New Roman"><span lang=EN-US
style='font-size:12.0pt'>It seems that this patch should solve the issue with
GMP. As I don&#8217;t really know how gcc works, I wonder whether it could
solve mine as well or if a similar fix should be applied elsewhere.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-US
style='font-size:10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-US
style='font-size:10.0pt;font-family:Arial;color:navy'>Now I am facing another
crash (exit code 128 without any information) in pure SML code so I guess I
will come back with additional feedback in a near future.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-US
style='font-size:10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-US
style='font-size:10.0pt;font-family:Arial;color:navy'>Best regards<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-US
style='font-size:10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-US
style='font-size:10.0pt;font-family:Arial;color:navy'>Nicolas<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-US
style='font-size:10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<div style='border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt'>

<div>

<div class=MsoNormal align=center style='text-align:center'><font size=3
face="Times New Roman"><span lang=EN-US style='font-size:12.0pt'>

<hr size=2 width="100%" align=center tabindex=-1>

</span></font></div>

<p class=MsoNormal><b><font size=2 face=Tahoma><span lang=EN-US
style='font-size:10.0pt;font-family:Tahoma;font-weight:bold'>From:</span></font></b><font
size=2 face=Tahoma><span lang=EN-US style='font-size:10.0pt;font-family:Tahoma'>
Wesley W. Terpstra [mailto:wesley@terpstra.ca] <br>
<b><span style='font-weight:bold'>Sent:</span></b> Tuesday, August 12, 2008
1:27 AM<br>
<b><span style='font-weight:bold'>To:</span></b> <st1:PersonName
ProductID="Nicolas Bertolotti" w:st="on">Nicolas Bertolotti</st1:PersonName>; <st1:PersonName
w:st="on">mlton@mlton.org</st1:PersonName><br>
<b><span style='font-weight:bold'>Subject:</span></b> Re: FW: [MLton] Working:
MLton/Win64 toolchain</span></font><span lang=EN-US><o:p></o:p></span></p>

</div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span lang=EN-US
style='font-size:12.0pt'><o:p>&nbsp;</o:p></span></font></p>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span lang=EN-US
style='font-size:12.0pt'>First, sorry about the multiple spammed replies! Gmail
told me it was failing to send and to come back later. When I came back later
and sent the definitive copy of my reply, I found that all my earlier clicks
had also succeeded. Oops.<br>
<br>
On Tue, Aug 12, 2008 at 12:22 AM, <st1:PersonName ProductID="Nicolas Bertolotti"
w:st="on">Nicolas Bertolotti</st1:PersonName> &lt;<a
href="mailto:Nicolas.Bertolotti@mathworks.fr">Nicolas.Bertolotti@mathworks.fr</a>&gt;
wrote: <o:p></o:p></span></font></p>

<div>

<blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;
margin-left:4.8pt;margin-right:0cm'>

<div link=blue vlink=blue>

<div>

<p><font size=2 color=navy face=Arial><span lang=EN-US style='font-size:10.0pt;
font-family:Arial;color:navy'>You can't see it in the sample but the original
piece of code on which I observed the crash is from the &quot;zlib&quot;
&#8230; and I thought I would not need to modify it.</span></font><span
lang=EN-US><o:p></o:p></span></p>

</div>

</div>

</blockquote>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span lang=EN-US
style='font-size:12.0pt'>Have you tried removing the -lkernel32? Does that
suffice?<o:p></o:p></span></font></p>

</div>

<blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;
margin-left:4.8pt;margin-right:0cm'>

<div link=blue vlink=blue>

<div>

<p><font size=2 color=navy face=Arial><span lang=EN-US style='font-size:10.0pt;
font-family:Arial;color:navy'>You mentioned that you faced a similar issue with
GMP. Did you submit a bug report to the GCC team?</span></font><span
lang=EN-US><o:p></o:p></span></p>

</div>

</div>

</blockquote>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span lang=EN-US
style='font-size:12.0pt'>Well, the right people to submit the bug report to are
the mingw-w64 people, specifically Kai Tietz. I didn't, because at the time I
hacked around the GMP problems gcc was so broken that it hardly seemed a useful
report. ;-) Now it's a lot better and maybe he should know about this. For gmp,
the problem was alloca (which also allocates on the stack). Fortunately, gmp
had a compile-time option to change it's use of alloca to malloc.&nbsp;<o:p></o:p></span></font></p>

</div>

</div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span lang=EN-US
style='font-size:12.0pt'><o:p>&nbsp;</o:p></span></font></p>

</div>

</div>

</div>

</body>

</html>