[vector] #100: Data.Vector.Unboxed.Mutable.unsafeWrite fails on -O2
vector
vector at projects.haskell.org
Fri Jul 12 12:20:00 BST 2013
#100: Data.Vector.Unboxed.Mutable.unsafeWrite fails on -O2
-------------------+--------------------------------------------------------
Reporter: Y_Less | Owner:
Type: defect | Status: new
Priority: major | Milestone:
Version: | Keywords:
-------------------+--------------------------------------------------------
As the title, but not always. I have a script with a reduced test case
that gives this result (when used with "inlinePerformIO", but also wrapped
in "return"):
{{{
inlinePerformIO $ do
let
len = r - prev
-- Copy the name from the source to the destination.
copyBytes (names `plusPtr` wName) (bsPtr `plusPtr` prev) len
-- Copy the start offsets.
putStrLn $ "hi" ++ show w0 ++ ": " ++ show wName ++ " = " ++ show
wProt
MVector.write nidx w0 wName
MVector.write pidx w0 wProt
return $ P6 3 (r + 1) (wName + len) wProt (w0 + 1) 0
}}}
The "MVector.write" line works correctly, but when replaced with
"MVector.unsafeWrite", fails to write the data out - despite the fact that
in this code the "putStrLn" is called correctly, the indexes are correct
and so don't need to be checked, and as far as I can see the underlying
implementation of "write" uses "unsafeWrite".
I can provide a more complete example if required, as I suspect it will be
given that "unsafeWrite" works fine in other places.
--
Ticket URL: <http://trac.haskell.org/vector/ticket/100>
vector <http://trac.haskell.org/vector>
Package vector
More information about the vector
mailing list