Skip to content

Consider load size when generating loads.

Andreas Klebinger requested to merge wip/sized_loads into master

We generate loads in the Arbitrary instance by loading a value from a pre-allocated 4M large buffer. We generated loads like this:

    loadGen :: Gen (Expr width)
    loadGen = do
        off <- chooseNumber (0, fromIntegral bufferSize-1)
        return $ ELoad $ ELit off

This was wrong since if we have an offset pointing at the last byte in the buffer we would read past the end of the buffer causing occasional segfaults. For a 64-bit load that means there is a 7:4194304 (~1:500k) chance we would generate an invalid load. This makes it pretty rare to hit this case in any particular quickcheck run. However it happend in ghc#24914 (comment 571270)

Merge request reports