[GHC] #8726: integer-gmp division regression
#8726: integer-gmp division regression --------------------------+------------------------------------------------ Reporter: erikd | Owner: Type: bug | Status: new Priority: normal | Milestone: 7.8.1 Component: | Version: 7.7 libraries (other) | Operating System: Unknown/Multiple Keywords: | Type of failure: Incorrect result at runtime Integer | Test Case: Architecture: | Blocking: Unknown/Multiple | Difficulty: | Unknown | Blocked By: | Related Tickets: | --------------------------+------------------------------------------------ With ghc 7.6.3: {{{ ghci> quotRem 0x10000000000000001 (-0x100000) (-17592186044416,1) ghci> quotRem 0x10000001 (-0x100000) (-256,1) }}} with ghc 7.7 {{{ ghci> quotRem 0x10000000000000001 (-0x100000) (-17592186044416,-1) ghci> quotRem 0x10000001 (-0x100000) (-256,1) }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8726> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#8726: integer-gmp division regression ------------------------------------------------+-------------------------- Reporter: erikd | Owner: hvr Type: bug | Status: new Priority: highest | Milestone: 7.8.1 Component: libraries (other) | Version: Resolution: | 7.8.1-rc1 Operating System: Unknown/Multiple | Keywords: Type of failure: Incorrect result at runtime | Integer-gmp Test Case: | Architecture: Blocking: | Unknown/Multiple | Difficulty: | Unknown | Blocked By: | Related Tickets: ------------------------------------------------+-------------------------- Changes (by hvr): * keywords: Integer => Integer-gmp * owner: => hvr * version: 7.7 => 7.8.1-rc1 * priority: normal => highest -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8726#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#8726: integer-gmp division regression ------------------------------------------------+-------------------------- Reporter: erikd | Owner: hvr Type: bug | Status: new Priority: highest | Milestone: 7.8.1 Component: libraries (other) | Version: Resolution: | 7.8.1-rc1 Operating System: Unknown/Multiple | Keywords: Type of failure: Incorrect result at runtime | Integer-gmp Test Case: | Architecture: Blocking: | Unknown/Multiple | Difficulty: | Unknown | Blocked By: | Related Tickets: ------------------------------------------------+-------------------------- Comment (by erikd): Related problems with divMod. ghc-7.6.3: {{{ Prelude> divMod 0x10000000000000001 (-0x100000) (-17592186044417,-1048575) Prelude> divMod 0x10000000001 (-0x100000) (-1048577,-1048575) }}} ghc-7.6: {{{ Prelude> divMod 0x10000000000000001 (-0x100000) (17592186044417,1048575) Prelude> divMod 0x10000000001 (-0x100000) (-1048577,-1048575) }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8726#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#8726: integer-gmp division regression ------------------------------------------------+-------------------------- Reporter: erikd | Owner: hvr Type: bug | Status: new Priority: highest | Milestone: 7.8.1 Component: libraries (other) | Version: Resolution: | 7.8.1-rc1 Operating System: Unknown/Multiple | Keywords: Type of failure: Incorrect result at runtime | Integer-gmp Test Case: | Architecture: Blocking: | Unknown/Multiple | Difficulty: | Unknown | Blocked By: | Related Tickets: ------------------------------------------------+-------------------------- Comment (by Herbert Valerio Riedel <hvr@…>): In [changeset:"5f64b2c6e8f1799d7015098598f7d6e826707e6c/ghc"]: {{{ #!CommitTicketReference repository="ghc" revision="5f64b2c6e8f1799d7015098598f7d6e826707e6c" Add test-case for #8726 This tests various properties expected to hold for quotRem, divMod, div, mod, quot, and rem. Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org> }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8726#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#8726: integer-gmp division regression ------------------------------------------------+-------------------------- Reporter: erikd | Owner: hvr Type: bug | Status: new Priority: highest | Milestone: 7.8.1 Component: libraries (other) | Version: Resolution: | 7.8.1-rc1 Operating System: Unknown/Multiple | Keywords: Type of failure: Incorrect result at runtime | Integer-gmp Test Case: | Architecture: Blocking: | Unknown/Multiple | Difficulty: | Unknown | Blocked By: | Related Tickets: ------------------------------------------------+-------------------------- Comment (by Herbert Valerio Riedel <hvr@…>): In [changeset:"2f841fdf5b33c4eb32cfc5d1b8207585f1880d9a/integer-gmp"]: {{{ #!CommitTicketReference repository="integer-gmp" revision="2f841fdf5b33c4eb32cfc5d1b8207585f1880d9a" Fix negation of `divMod`/`quotRem` results (fixes #8726) High-level pseudo code of what the code was supposed to implement: quotRem' :: Integer -> Integer -> (Integer,Integer) quotRem' a b@(S# _) | b < 0 = negFst . uncurry quotRem' . negSnd $ (a,b) | otherwise = quotRemUI a (fromIntegral (abs b)) divMod' :: Integer -> Integer -> (Integer,Integer) divMod' a b@(S# _) | b < 0 = negSnd . uncurry divMod' . negBoth $ (a,b) | otherwise = divModUI a (fromIntegral b) negFst (q,r) = (-q,r) negSnd (q,r) = ( q,-r) negBoth (q,r) = (-q,-r) -- quotRemUI and divModUI represent GMP's `mpz_{f,t}div_qr_ui()` quotRemUI, divModUI :: Integer -> Word -> (Integer,Integer) Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org> }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8726#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#8726: integer-gmp division regression ------------------------------------------------+-------------------------- Reporter: erikd | Owner: hvr Type: bug | Status: closed Priority: highest | Milestone: 7.8.1 Component: libraries (other) | Version: Resolution: fixed | 7.8.1-rc1 Operating System: Unknown/Multiple | Keywords: Type of failure: Incorrect result at runtime | Integer-gmp Test Case: | Architecture: Blocking: | Unknown/Multiple | Difficulty: | Unknown | Blocked By: | Related Tickets: ------------------------------------------------+-------------------------- Changes (by thoughtpolice): * status: new => closed * resolution: => fixed Comment: Merged to HEAD/7.8 by Herbert. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8726#comment:5> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#8726: integer-gmp division regression ------------------------------------------------+-------------------------- Reporter: erikd | Owner: hvr Type: bug | Status: closed Priority: highest | Milestone: 7.8.1 Component: libraries (other) | Version: Resolution: fixed | 7.8.1-rc1 Operating System: Unknown/Multiple | Keywords: Type of failure: Incorrect result at runtime | integer-gmp Test Case: numeric/should_run/T8726 | Architecture: Blocking: | Unknown/Multiple | Difficulty: | Unknown | Blocked By: | Related Tickets: #8647 ------------------------------------------------+-------------------------- Changes (by hvr): * keywords: Integer-gmp => integer-gmp * testcase: => numeric/should_run/T8726 * related: => #8647 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8726#comment:6> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC