Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In at least some cases (eg in C11 partialSC), R+W events have a register associated with them, and that register feeds into the forbidden execution. For instance, one such event structure is (mind my ASCII):
In this case, both RMWs store the read value to
r0
, because the witnessing C execution is(0:r0 = 0 /\ 1:r0 = 0 /\ x=2)
.However, at the moment, this register is thrown away at the Litmus level and replaced with a temporary
expected
value, with the postcondition just pointing to a danglingr0
(or, onmaster
, not mentioning those registers at all).This is an attempt to push those registers through the Litmus IR and into the pretty-printer for C. I've assumed that there still exist possibilities where the RMW does not spill to a register, so I've extended the
Cas(...)
variant withan optional register, and kept the old logic around for when this is
None
.I'm not sure if this change adversely affects other CAS instances eg. on other models, so there might need to be some further work needed; for this reason and because there are issues with
master
not propagating the registers through (not sure why not), this is targetingdev
.Example output for above event structure before changes:
The postcondition here is right, but it refers to
r0
instead ofexpected
(the default variable introduced when there is no register for a CAS). (The currentmaster
version of Memalloy gives usexists (x == 2)
, which is clearly too general; as mentioned before, when I've tried to apply this change there, the event registers haven't been available and there's no change)And after: