<div dir="ltr">Simon M, is the intention of ByteOff and WordOff that they should be able to represent negative quantities as well? If so we might need to split it into ByteOff (still an Int) and ByteIndex (a Word) to have a type for indexing into arrays.</div>

<div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Aug 7, 2014 at 1:16 PM, Edward Z. Yang <span dir="ltr"><<a href="mailto:ezyang@mit.edu" target="_blank">ezyang@mit.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

If it's strictly just in the codegen (and not affecting user code),<br>
seems fine to me.<br>
<br>
Edward<br>
<br>
Excerpts from Johan Tibell's message of 2014-08-07 12:10:37 +0100:<br>
<div class="HOEnZb"><div class="h5">> Inside GHC we mostly use Int instead of Word, even when we want to<br>
> represent non-negative values, such as sizes of things or indices into<br>
> things. This is now causing some grief in<br>
> <a href="https://ghc.haskell.org/trac/ghc/ticket/9416" target="_blank">https://ghc.haskell.org/trac/ghc/ticket/9416</a>, where an allocation boundary<br>
> case test fails with a segfault because a n < m Int comparison overflows.<br>
><br>
> I tried to fix the issue by changing the type of maxInlineAllocSize, which<br>
> is used on one side of the above comparison, to Word. However, that<br>
> unravels a bunch of other issues, such as wordsToBytes, ByteOff, etc are<br>
> all Int-valued quantities.<br>
><br>
> I could perhaps work around these problems by judicious use of fromIntegral<br>
> in StgCmmPrim, but I'm a bit unhappy about it because it 1) makes the code<br>
> uglier and 2) needs to be done in quite a few places.<br>
><br>
> How much work would it be to try to switch the codegen to use Word for most<br>
> of these quantities instead?<br>
><br>
> -- Johan<br>
</div></div></blockquote></div><br></div>