#3800: sizeofByteArray# returns allocated words, not requested length in bytes
---------------------------------+------------------------------------------
    Reporter:  AntoineLatter     |        Owner:                             
        Type:  bug               |       Status:  new                        
    Priority:  high              |    Milestone:  6.14.1                     
   Component:  Compiler          |      Version:  6.12.1                     
    Keywords:                    |   Difficulty:                             
          Os:  Unknown/Multiple  |     Testcase:                             
Architecture:  Unknown/Multiple  |      Failure:  Incorrect result at runtime
---------------------------------+------------------------------------------
Description changed by igloo:

Old description:

> A byte array allocated with (GHC.Prim.newByteArray# 7) will report it's
> size as '8' - that is, the stored size in StgArrWords is the number of
> allocated words, not the number of requested bytes.
>
> This menas that if I want to a GHC.Prim.ByteArray# or MutableByteArray#
> as an array type, I need a separate length fields.
>
> See also: http://www.haskell.org/pipermail/glasgow-haskell-
> users/2009-December/018199.html

New description:

 A byte array allocated with (`GHC.Prim.newByteArray# 7`) will report it's
 size as '8' - that is, the stored size in `StgArrWords` is the number of
 allocated words, not the number of requested bytes.

 This menas that if I want to a `GHC.Prim.ByteArray#` or
 `MutableByteArray#` as an array type, I need a separate length fields.

 See also: http://www.haskell.org/pipermail/glasgow-haskell-
 users/2009-December/018199.html

--

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3800#comment:6>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to