id,summary,reporter,owner,description,type,status,priority,milestone,component,version,resolution,keywords,cc,os,architecture,failure,difficulty,testcase,blockedby,blocking,related
2647,Serious typo in IntMap.hs,sedillard,,"Someone has recently (since 6.8.3) taken a ""style"" pass over `IntMap.hs`. Apparently they didn't like reusing identifiers in different scopes, so they changed this function (at the very core of `IntMap`) from this 

{{{
highestBitMask :: Nat -> Nat
highestBitMask x
  = case (x .|. shiftRL x 1) of 
     x -> case (x .|. shiftRL x 2) of 
      x -> case (x .|. shiftRL x 4) of 
       x -> case (x .|. shiftRL x 8) of 
        x -> case (x .|. shiftRL x 16) of 
         x -> case (x .|. shiftRL x 32) of   -- for 64 bit platforms
          x -> (x `xor` (shiftRL x 1))
}}}

to this 

{{{
highestBitMask :: Nat -> Nat
highestBitMask x0
  = case (x0 .|. shiftRL x0 1) of
     x1 -> case (x1 .|. shiftRL x1 2) of
      x2 -> case (x2 .|. shiftRL x2 4) of
       x3 -> case (x3 .|. shiftRL x3 8) of
        x4 -> case (x3 .|. shiftRL x4 16) of
         x5 -> case (x4 .|. shiftRL x5 32) of   -- for 64 bit platforms
          x6 -> (x6 `xor` (shiftRL x6 1))
}}}

If you stare at it long enough, you might find the typo. Don't cheat and look at the patch. I'll give you a hint: quickcheck won't find it because the tests don't use big enough integers. 

Needless to say this completely breaks the library, and if it ain't broke... :)


",bug,closed,normal,6.10.1,libraries (other),6.9,fixed,containers IntMap,,Unknown/Multiple,Unknown/Multiple,,Unknown,,,,
