Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Fix match miscompilation with flambda #2239
The translation of the switch construct in
For the record, here is @lpw25 's explanation as to when this bug can be hit:
Essentially you need a match where every case is on a non-immediate constructor and where the bodies of the cases are not identical but will become identical once flambda has optimised them. The value being matched must be produced by a side-effecting expression where the result is not constant and the side-effects cannot be lifted out of the expression. In such a case the expression will be incorrectly discarded losing the side-effect.