[Haskell-cafe] Optimization flag changing result of code execution

kudah kudahkukarek at gmail.com
Tue Jul 9 23:38:55 CEST 2013

I've attached the script that I had trouble with. It tries to replicate
one directory structure in another directory, while replacing filenames
and file contents with random data. When compiled with -O1 or -O2
resulting file and directory names are composed only of a's and b's,
but file contents seem properly randomized.

ghc-7.6.2, vector-, primitive-, mwc-random-,
Gentoo Linux i686 3.8.2-pf.

On Tue, 09 Jul 2013 22:43:36 +0400 Aleksey Khudyakov
<alexey.skladnoy at gmail.com> wrote:

> On 09.07.2013 22:10, kudah wrote:
> > Same here, I used mwc-random to generate random strings. It works in
> > ghci and when compiled with -O0, but with -O1 and -O2 I've been
> > getting exclusively a's and b's.
> >
> It looks like MWC generates only 0 and 1 for some reason. I've tried
> to write simple test but everything works fine. Could you post test
> case and compiler/libraries/OS versions you use?
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ReplicateDirStructure.hs
Type: text/x-haskell
Size: 2151 bytes
Desc: not available
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20130710/97337fbe/attachment.hs>

More information about the Haskell-Cafe mailing list