[commit: ghc] master: testsuite: Fix overflow in T13623 on 32-bit machines (1126e69)

git at git.haskell.org git at git.haskell.org
Tue Apr 24 16:08:59 UTC 2018


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/1126e6942624f4e6578e59b2a28b9848ad9fcea2/ghc

>---------------------------------------------------------------

commit 1126e6942624f4e6578e59b2a28b9848ad9fcea2
Author: Ben Gamari <bgamari.foss at gmail.com>
Date:   Mon Apr 23 10:41:38 2018 -0400

    testsuite: Fix overflow in T13623 on 32-bit machines
    
    We simply truncate the result to 32-bits to ensure that the test passed
    under both environments.
    
    Test Plan: Validate on 32-bit
    
    Subscribers: thomie, carter
    
    GHC Trac Issues: #13623
    
    Differential Revision: https://phabricator.haskell.org/D4615


>---------------------------------------------------------------

1126e6942624f4e6578e59b2a28b9848ad9fcea2
 testsuite/tests/perf/should_run/T13623.hs     | 5 ++++-
 testsuite/tests/perf/should_run/T13623.stdout | 2 +-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/testsuite/tests/perf/should_run/T13623.hs b/testsuite/tests/perf/should_run/T13623.hs
index 7a048b2..83004f3 100644
--- a/testsuite/tests/perf/should_run/T13623.hs
+++ b/testsuite/tests/perf/should_run/T13623.hs
@@ -4,6 +4,7 @@
 module Main where
 
 
+import Data.Int
 import GHC.Types
 
 
@@ -16,7 +17,9 @@ foo = \i j -> sfoldl' (+) 0 $ xs i j +++ ys i j
 {-# Inline foo #-}
 
 
-main = do { n <- foo 1 1; print n }
+-- We narrow the result to 32-bits to account for the fact that this overflows
+-- on 32-bit machines.
+main = do { n <- foo 1 1; print (fromIntegral n :: Int32) }
 
 
 
diff --git a/testsuite/tests/perf/should_run/T13623.stdout b/testsuite/tests/perf/should_run/T13623.stdout
index ac3eff3..c94819c 100644
--- a/testsuite/tests/perf/should_run/T13623.stdout
+++ b/testsuite/tests/perf/should_run/T13623.stdout
@@ -1 +1 @@
-65000250000
+575740560



More information about the ghc-commits mailing list