There are two bugs here.
(1) When the value being incremented is const, and the result is ignored, we assume this cannot be observed, and emit no code. However if the value being incremented is not a primitive & has a valueOf conversion, then this should be being called.
(2) In the case of a pre-increment of a const value where the result is not ignored, we'll move +/-1 to the destination, then add the resolved const value being incremented to this. This is problematic if the destination is a local, and the const value being incremented has a valueOf conversion that throws - the destination will be modified erroneously. Instead, we need to use a temporary location.
Created attachment 162148 [details]
Comment on attachment 162148 [details]
Fixed in r127544