Hello,<br><br>It seems this bug has already been submitted:<br><a href="http://hackage.haskell.org/trac/ghc/ticket/2120">http://hackage.haskell.org/trac/ghc/ticket/2120</a><br><br>Thanks for the help.<br>__<br>Donnie Jones<br>
<br><div><span class="gmail_quote">On 3/14/08, <b class="gmail_sendername">Cale Gibbard</b> &lt;<a href="mailto:cgibbard@gmail.com">cgibbard@gmail.com</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Here&#39;s the bug:<br> <br> {-# INLINE safeIndex #-}<br> safeIndex :: Ix i =&gt; (i, i) -&gt; Int -&gt; i -&gt; Int<br> safeIndex (l,u) n i = let i&#39; = unsafeIndex (l,u) i<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;in if (0 &lt;= i&#39;) &amp;&amp; (i&#39; &lt; n)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; then i&#39;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else error &quot;Error in array index&quot;<br> <br> unsafeIndex here is just a function which transforms indices into Int<br> indices into the flat array and does no checking of validity. Then<br>
 safeIndex simply checks if the result is nonnegative and less than the<br> size of the array. Whoops! The actual test to see if the index was<br> valid in the first place didn&#39;t actually get performed!<br> <br><br>&nbsp;&nbsp;- Cale<br>
 <br><br> On 14/03/2008, Eric Mertens &lt;<a href="mailto:emertens@gmail.com">emertens@gmail.com</a>&gt; wrote:<br> &gt; Smaller example of this behavior:<br> &gt;<br> &gt;&nbsp;&nbsp;&gt; array ((0,0),(1,1)) [((1,1),6)] ! (0,3)<br>
 &gt;&nbsp;&nbsp;6<br> &gt;<br> &gt;&nbsp;&nbsp;--<br> &gt;<br> &gt; Eric Mertens<br> &gt;<br> &gt; _______________________________________________<br> &gt;&nbsp;&nbsp;Haskell-Cafe mailing list<br> &gt;&nbsp;&nbsp;<a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
 &gt;&nbsp;&nbsp;<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br> &gt;<br> _______________________________________________<br> Haskell-Cafe mailing list<br>
 <a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br> <a href="http://www.haskell.org/mailman/listinfo/haskell-cafe">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br> </blockquote></div><br>