Skip to content

Commit

Permalink
Fix to Lheap_Add translation (#740)
Browse files Browse the repository at this point in the history
Lheap_Add primitive adds a cell to a linear heap. This PR changes the
translation so that only the domain of the target heap is modified. The
heap contents is assumed (magically) to contain the value being inserted
at the fresh address. This is sound because Ref T, the address type for
Lheap T is uninterpreted and potentially infinite source of cells with a
particular value.
  • Loading branch information
shazqadeer authored May 31, 2023
1 parent 0064910 commit 38b0d21
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Source/Concurrency/LinearRewriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -302,11 +302,12 @@ private List<Cmd> RewriteLheapAdd(CallCmd callCmd)

cmdSeq.Add(CmdHelper.HavocCmd(k));
cmdSeq.Add(CmdHelper.AssumeCmd(Expr.Not(ExprHelper.FunctionCall(new MapSelect(callCmd.tok, 1), Dom(path), k))));
cmdSeq.Add(CmdHelper.AssumeCmd(Expr.Eq(ExprHelper.FunctionCall(new MapSelect(callCmd.tok, 1), Val(path), k), v)));
cmdSeq.Add(CmdHelper.AssignCmd(
CmdHelper.ExprToAssignLhs(path),
ExprHelper.FunctionCall(lheapConstructor,
ExprHelper.FunctionCall(new MapStore(callCmd.tok, 1), Dom(path), k, Expr.True),
ExprHelper.FunctionCall(new MapStore(callCmd.tok, 1), Val(path), k, v))));
Val(path))));

ResolveAndTypecheck(options, cmdSeq);
return cmdSeq;
Expand Down

0 comments on commit 38b0d21

Please sign in to comment.