Skip to content

Optimization causes HUnit to behave incorrectly

When I build the following program with "ghc -O2 --make ...", the unit test passes. I expect the test to fail because 1 does not equal 2. Compiling without optimization results in correct behavior.

I'm not sure if this is a compiler bug but I'm filing it as such because of the dependence on optimization. I'm running ghc on Mac OS 10.6.3 installed from the downloaded file haskell-platform-2010.1.0.1-i386.dmg. The ghc version is 6.12.1.

import Test.HUnit

tests = test [ test [1 ~?= 2] ]

main = runTestTT tests

Trac metadata
Trac field Value
Version 6.12.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information