Broken ghc-7.0.3/vector combination?

Daniel Fischer at
Wed Apr 20 19:44:32 CEST 2011

On Wednesday 20 April 2011 19:11:07, Roman Leshchinskiy wrote:
> Daniel Fischer wrote:
> > Further investigation of the sorting code in vector-algorithms
> > revealed no bugs there, and if the runtime was forced to keep a keen
> > eye on the indices, by replacing unsafeRead/Write/Swap with their
> > bounds-checked counterparts or by 'trace'ing enough of their uses,
> > the NaNs did not appear.
> Did you replace them in vector-algorithms or in vector itself?

vector-algorithms only.

> > So, is it possible that some change in ghc-7.0.3 vs. the previous
> > versions caused a bad interaction between ghc-optimisations and vector
> > fusion resulting in bad vector reads/writes?
> Am I right in assuming that this happens in code which uses only mutable
> vectors?

Yes, the sorting uses mutable vectors, in this case unboxed Double vectors.

> Fusion only works for immutable ones so it shouldn't really
> affect things here.

Ah, didn't know that. Another suspect gone.

> Have you tried playing around with code generation flags like -msse2?

No, not yet. So far only -O2 (with -fspec-constr-count=5 in the presence of 
many trace calls) and -O0.

> In any case, I would try to take a look at this if you tell me how to
> reproduce.

I'll prepare a bundle, I'm afraid it won't be small, though. And it might 
be architecture dependent, so I can't guarantee that you will be able to 
reproduce it. But Bryan said on IRC yesterday that others have reported 
similar issues with criterion output, so it may well be cross-platform 


More information about the Glasgow-haskell-users mailing list