[commit: ghc] wip/T10137: CmmSwitch: Replace TODO by a reference to the test case (9e2a5e0)

git at git.haskell.org git at git.haskell.org
Tue Mar 17 12:03:42 UTC 2015


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

On branch  : wip/T10137
Link       : http://ghc.haskell.org/trac/ghc/changeset/9e2a5e02d0a7e3d540c4e36fd349f61c1f7da2dd/ghc

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

commit 9e2a5e02d0a7e3d540c4e36fd349f61c1f7da2dd
Author: Joachim Breitner <mail at joachim-breitner.de>
Date:   Tue Mar 17 13:03:36 2015 +0100

    CmmSwitch: Replace TODO by a reference to the test case


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

9e2a5e02d0a7e3d540c4e36fd349f61c1f7da2dd
 compiler/cmm/CmmSwitch.hs | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/compiler/cmm/CmmSwitch.hs b/compiler/cmm/CmmSwitch.hs
index c44c37c..d91d693 100644
--- a/compiler/cmm/CmmSwitch.hs
+++ b/compiler/cmm/CmmSwitch.hs
@@ -138,8 +138,8 @@ switchTargetsSigned (SwitchTargets signed _ _ _) = signed
 
 -- switchTargetsToTable creates a dense jump table, usable for code generation.
 -- Returns an offset to add to the value; the list is 0-based on the result
---
--- TODO: Is the conversion from Integral to Int fishy?
+-- The conversion from Integer to Int is a bit of a wart, but works due to
+-- wrap-around arithmetic (as verified by the CmmSwitchTest test case).
 switchTargetsToTable :: SwitchTargets -> (Int, [Maybe Label])
 switchTargetsToTable (SwitchTargets _ (lo,hi) mbdef branches)
     = (fromIntegral (-start), [ labelFor i | i <- [start..hi] ])



More information about the ghc-commits mailing list