<div>Hi all,</div><div><br></div><div>A program that I built with GHC is crashing at runtime with the following error:</div><div><br></div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">    internal error: eval_thunk_selector: strange selectee 12</font><div>

<br></div><div>I have not found much via Google, just an old post regarding ghc 6.0 that recommends cleaning and rebuilding.  I have cleaned the build directory and re-built the executable, and I still get the error.</div>

<div><br></div><div><div>The program is a compiler, and this error began showing up after I added support for memoization of results using the ST Monad and STRefs.  For example, the following function creates a reference to a thunk:</div>

<div><br></div><div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">newMutableRef m</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">  = do ref &lt;- newSTRef $ error &quot;access ref too soon!&quot;</font></div>

<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">       let m&#39; = do r &lt;- m</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">                   writeSTRef ref (return r)</font></div>

<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">                   return r</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">       writeSTRef ref m&#39;</font></div>

<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">       return $ ref</font></div></div></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace"><br></font></div><div>Here&#39;s some information about my system:</div>

<div><ul><li>GHC 6.12.1</li><li>Mac OS X 10.6.3 (Snow Leopard)</li></ul></div><div>So, what could cause this error?  Any suggestions that can help me narrow down the problem would be greatly appreciated.  If this is in fact a GHC bug, I&#39;d like to find a workaround for now and also reproduce it in a small example so I can file a bug report.</div>

<div><br></div><div>- Philip</div><div><br></div>