[commit: ghc] master: Fix off-by-one error in FastString.getFastStringTable (#8110) (85c1715)

git at git.haskell.org git at git.haskell.org
Fri Aug 30 17:23:43 CEST 2013


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/85c1715d086bf2d35bc05133398f462919f2aa7b/ghc

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

commit 85c1715d086bf2d35bc05133398f462919f2aa7b
Author: Patrick Palka <patrick at parcs.ath.cx>
Date:   Fri Aug 30 11:14:40 2013 -0400

    Fix off-by-one error in FastString.getFastStringTable (#8110)
    
    The function was reading past the end of the FastString table, causing
    the -dfaststring-stats option to behave unpredictably.


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

85c1715d086bf2d35bc05133398f462919f2aa7b
 compiler/utils/FastString.lhs |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/compiler/utils/FastString.lhs b/compiler/utils/FastString.lhs
index 25f9802..2800d8a 100644
--- a/compiler/utils/FastString.lhs
+++ b/compiler/utils/FastString.lhs
@@ -530,7 +530,7 @@ nilFS = mkFastString ""
 getFastStringTable :: IO [[FastString]]
 getFastStringTable = do
   tbl <- readIORef string_table
-  buckets <- mapM (lookupTbl tbl) [0 .. hASH_TBL_SIZE]
+  buckets <- mapM (lookupTbl tbl) [0 .. hASH_TBL_SIZE-1]
   return buckets
 
 -- -----------------------------------------------------------------------------





More information about the ghc-commits mailing list