From 7916b1f9aa93fca368afda8b18396230ac7f338c Mon Sep 17 00:00:00 2001 From: Araq Date: Sun, 21 Sep 2014 18:39:00 +0200 Subject: implemented 'guard' annotation --- compiler/guards.nim | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'compiler/guards.nim') diff --git a/compiler/guards.nim b/compiler/guards.nim index 05128f409..cd0aaf296 100644 --- a/compiler/guards.nim +++ b/compiler/guards.nim @@ -838,6 +838,22 @@ proc addAsgnFact*(m: var TModel, key, value: PNode) = fact.sons[2] = value m.add fact +proc sameSubexprs*(m: TModel; a, b: PNode): bool = + # This should be used to check whether two *path expressions* refer to the + # same memory location according to 'm'. This is tricky: + # lock a[i].guard: + # ... + # access a[i].guarded + # + # Here a[i] is the same as a[i] iff 'i' and 'a' are not changed via '...'. + # However, nil checking requires exactly the same mechanism! But for now + # we simply use sameTree and live with the unsoundness of the analysis. + var check = newNodeI(nkCall, a.info, 3) + check.sons[0] = newSymNode(opEq) + check.sons[1] = a + check.sons[2] = b + result = m.doesImply(check) == impYes + proc addCaseBranchFacts*(m: var TModel, n: PNode, i: int) = let branch = n.sons[i] if branch.kind == nkOfBranch: -- cgit 1.4.1-2-gfad0 199a2fd37568a5f5a6c7c394b160b229e90c'>refs log blame commit diff stats
path: root/tests/manyloc/packages/os.nim
blob: 8a59612f99efbf5d82d3c5b89ad84ffbd350a91d (plain) (tree)
1
2
3
4
5