Skip to content

Issue in constraint generation enforcing reads-from #39

Description

@reeselevine

If I have the following simple test, which checks whether a load returns a previous store, the test fails (a satisfiable solution is found).

NEWWG
NEWSG
NEWTHREAD
st.sc0 c = 1
ld.sc0 c = 2
NOSOLUTION consistent[X] && #dr=0

Looking at the counterexample generated, the issue appears to be that Alloy happily puts a reads-from relation between the two instructions, despite 2 not being the value written previously. When putting ld.sc0 c = 0, the test passes, because a constraint of the form E1 in X.RFINIT is correctly generated. The issue exists for both atomic/non-atomic instructions.

I don't think the problem is with the model, it looks like adding a not in constraint to rf fixes the problem, which can be done in litmus.cpp by adding the following code to lines 534-547:

            } else if (instState.loadStore[i].var == instState.loadStore[j].var &&
                instState.isWrite(i) && instState.isRead(j) &&
                instState.getWriteValue(i) != instState.getReadValue(j)) {
                o << "    (E" << i << "->E" << j << ") not in X.rf\n";

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions