[Haskell-cafe] ghc -O2 and HUnit weirdness
roma at ro-che.info
Fri Jan 7 00:48:22 CET 2011
* Roman Cheplyaka <roma at ro-che.info> [2011-01-07 01:42:24+0200]
> * Jürgen Doser <jurgen.doser at gmail.com> [2011-01-07 00:18:09+0100]
> > El jue, 06-01-2011 a las 16:41 -0400, Joey Hess escribió:
> > > So, the problem seems to be that ghc -O2 somehow optimises the static
> > > assertBool _ True away, in what seems to be a bad way. Remove the -O2 and
> > > the test fails as expected. Presumably, although I have not verified,
> > > less static boolean values would not trigger the optimisation.
> > > Is this a ghc or HUnit bug?
> > >
> > > (Versions: 6.12.1, 22.214.171.124)
> > Looks like a GHC bug.
> Works with -fno-state-hack.
Here's a particular quote from the GHC source 
Technically, this isn't quite right, because (f True) `seq` 1 should
diverge, but it'll converge if we eta-expand f. Nevertheless, we do
so; it improves some programs significantly, and increasing
convergence isn't a bad thing.
As it turns out in the case of HUnit, it may be a bad thing.
Roman I. Cheplyaka :: http://ro-che.info/
Don't worry what people think, they don't do it very often.
More information about the Haskell-Cafe