Broken ghc-7.0.3/vector combination?

Daniel Fischer at
Wed Apr 20 22:36:34 CEST 2011

On Wednesday 20 April 2011 21:55:51, Dan Doel wrote:
> It's not a statistics bug. I'm reproducing it here using just
> vector-algorithms.

Yep. Attached a simple testcasewhich reproduces it and uses only vector and 

> Fill a vector of size N with [N..1], and (intro) sort it, and you get
> NaNs. But only with -O or above.

However, for me the NaNs disappear with the -msse2 option.

> Without optimization it doesn't
> happen (and nothing seems to be reading/writing out of bounds, as I
> compiled vector with UnsafeChecks earlier and it didn't complain).

Nor does it happen here with 7.0.2 or 7.0.1.

> Filling the vector with [1..N] also doesn't trigger the NaNs. [0,0..0]
> and [0,0..1] trigger it.
> I don't know what's going on yet. I have trouble believing it's a bug
> in vector-algorithms code, though, as I don't think I've written any
> RULEs (just INLINEs), and that's the one thing that comes to mind in
> library code that could cause a difference between -O0 and -O. So I'd
> tentatively suggest it's a vector, base or compiler bug.
> The above testing is on 64-bit windows running a 32-bit copy of GHC,
> for reference.

32-bit linux here

> My ability to investigate this will be a bit limited for the near
> future. If someone definitively tracks it down to bugs in my code,
> though, let me know, and I'll try and push a new release up on
> hackage.
> -- Dan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: simpleTest.hs
Type: text/x-haskell
Size: 1203 bytes
Desc: not available
URL: <>

More information about the Glasgow-haskell-users mailing list