Permalink
Browse files

Workaround GHC bug: http://hackage.haskell.org/trac/ghc/ticket/7233

In particular, detect if the platform we're running on has the bug and
avoid running those test cases. This is not kosher of course, but
otherwise the Travis-CI automated tester chokes for no fault of SBV's..
  • Loading branch information...
1 parent 87c8f7d commit a161039b312b3531c8a1f9b94452b9b1595f54f6 @LeventErkok committed Sep 10, 2012
Showing with 12 additions and 3 deletions.
  1. +1 −1 SBVUnitTest/SBVUnitTestBuildTime.hs
  2. +11 −2 SBVUnitTest/TestSuite/Basics/ArithNoSolver.hs
@@ -2,4 +2,4 @@
module SBVUnitTestBuildTime (buildTime) where
buildTime :: String
-buildTime = "Sun Sep 9 01:04:43 PDT 2012"
+buildTime = "Sun Sep 9 20:05:27 PDT 2012"
@@ -176,8 +176,10 @@ genQRems = map mkTest $
++ zipWith pair [("divMod", show x, show y, x `divMod'` y) | x <- i8s, y <- i8s , noOverflow x y] [x `sDivMod` y | x <- si8s, y <- si8s , noOverflow x y]
++ zipWith pair [("divMod", show x, show y, x `divMod'` y) | x <- i16s, y <- i16s, noOverflow x y] [x `sDivMod` y | x <- si16s, y <- si16s, noOverflow x y]
++ zipWith pair [("divMod", show x, show y, x `divMod'` y) | x <- i32s, y <- i32s, noOverflow x y] [x `sDivMod` y | x <- si32s, y <- si32s, noOverflow x y]
- -- TODO: Looks like divMod on Int64 has a bug in GHC 7.4.1 on Linux. Comment this out until it's resolved.
- -- ++ zipWith pair [("divMod", show x, show y, x `divMod'` y) | x <- i64s, y <- i64s, noOverflow x y] [x `sDivMod` y | x <- si64s, y <- si64s, noOverflow x y]
+ ++ (if divModInt64Bug -- see below
+ then []
+ else zipWith pair [("divMod", show x, show y, x `divMod'` y) | x <- i64s, y <- i64s, noOverflow x y] [x `sDivMod` y | x <- si64s, y <- si64s, noOverflow x y]
+ )
++ zipWith pair [("divMod", show x, show y, x `divMod'` y) | x <- iUBs, y <- iUBs] [x `sDivMod` y | x <- siUBs, y <- siUBs]
++ zipWith pair [("quotRem", show x, show y, x `quotRem'` y) | x <- w8s, y <- w8s ] [x `sQuotRem` y | x <- sw8s, y <- sw8s ]
++ zipWith pair [("quotRem", show x, show y, x `quotRem'` y) | x <- w16s, y <- w16s] [x `sQuotRem` y | x <- sw16s, y <- sw16s]
@@ -276,3 +278,10 @@ rs = [fromRational (i % d) | i <- is, d <- ds]
srs :: [SReal]
srs = map literal rs
+
+
+-- On 32 bit installations of GHC, divMod is buggy for Int64
+-- Thus causing our tests to fail. See ticket: http://hackage.haskell.org/trac/ghc/ticket/7233
+-- Luckily, it's easy to detect it and sidestep it until GHC is appropriately patched
+divModInt64Bug :: Bool
+divModInt64Bug = (1 `div` (minBound::Int64)) /= -1 -- Bug causes this expression to evaluate to 1

0 comments on commit a161039

Please sign in to comment.