@@ -144,7 +144,7 @@ import Control.DeepSeq (NFData (..), NFData1 (..), NFData2 (..))
144144import Control.Monad.ST (ST , runST )
145145import Data.Bifoldable (Bifoldable (.. ))
146146import Data.Bits (complement , popCount , unsafeShiftL ,
147- unsafeShiftR , (.&.) , (.|.) , countTrailingZeros )
147+ unsafeShiftR , (.&.) , (.|.) , countTrailingZeros , shiftL )
148148import Data.Coerce (coerce )
149149import Data.Data (Constr , Data (.. ), DataType )
150150import Data.Functor.Classes (Eq1 (.. ), Eq2 (.. ), Ord1 (.. ), Ord2 (.. ),
@@ -2257,7 +2257,9 @@ index w s = fromIntegral $ unsafeShiftR w s .&. subkeyMask
22572257
22582258-- | A bitmask with the 'bitsPerSubkey' least significant bits set.
22592259fullNodeMask :: 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)
22612263{-# INLINE fullNodeMask #-}
22622264
22632265-- | Check if two the two arguments are the same value. N.B. This
0 commit comments