@@ -144,7 +144,7 @@ import Control.DeepSeq (NFData (..), NFData1 (..), NFData2 (..))
144
144
import Control.Monad.ST (ST , runST )
145
145
import Data.Bifoldable (Bifoldable (.. ))
146
146
import Data.Bits (complement , popCount , unsafeShiftL ,
147
- unsafeShiftR , (.&.) , (.|.) , countTrailingZeros )
147
+ unsafeShiftR , (.&.) , (.|.) , countTrailingZeros , shiftL )
148
148
import Data.Coerce (coerce )
149
149
import Data.Data (Constr , Data (.. ), DataType )
150
150
import Data.Functor.Classes (Eq1 (.. ), Eq2 (.. ), Ord1 (.. ), Ord2 (.. ),
@@ -2257,7 +2257,9 @@ index w s = fromIntegral $ unsafeShiftR w s .&. subkeyMask
2257
2257
2258
2258
-- | A bitmask with the 'bitsPerSubkey' least significant bits set.
2259
2259
fullNodeMask :: Bitmap
2260
- fullNodeMask = complement (complement 0 `unsafeShiftL` maxChildren)
2260
+ -- This needs to use 'shiftL' instead of 'unsafeShiftL', to avoid UB.
2261
+ -- See issue #412.
2262
+ fullNodeMask = complement (complement 0 `shiftL` maxChildren)
2261
2263
{-# INLINE fullNodeMask #-}
2262
2264
2263
2265
-- | Check if two the two arguments are the same value. N.B. This
0 commit comments