forked from SoftwareFoundationGroupAtKyotoU/consort
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request SoftwareFoundationGroupAtKyotoU#22 from SoftwareFo…
…undationGroupAtKyotoU/fix-by-koba fix for the problem in handling dereferences
- Loading branch information
Showing
6 changed files
with
94 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
Test whether values in a recursive data structure are havocked correctly at an alias statement. | ||
*/ | ||
|
||
create_list() { | ||
if _ then | ||
null | ||
else | ||
let tail = create_list() in | ||
let tup = (1, tail) in | ||
mkref tup | ||
} | ||
|
||
{ | ||
let l = create_list() in | ||
let (_, l1) = *l in | ||
{ | ||
alias(l1 = (*l).1); | ||
l1 := (99, null); | ||
alias(l1 = (*l).1); | ||
assert(1 = 2) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
Test whether values in a recursive data structure are havocked correctly at a deref expression. | ||
If values (under references whose ownerships are 0) are not havocked correctly, | ||
then our alias assumption | ||
(i.e. two references point to the same memory location = they have the same value) | ||
becomes wrong. The verification will become unsound. | ||
*/ | ||
|
||
create_list() { | ||
if _ then | ||
null | ||
else | ||
let tail = create_list() in | ||
let tup = (1, tail) in | ||
mkref tup | ||
} | ||
|
||
{ | ||
let l = create_list() in | ||
let (v1, l1) = *l in | ||
{ | ||
l1 := (999, null); | ||
alias(l1 = (*l).1); | ||
assert(1 = 2) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* | ||
Test that we are not havocking everything at let expressions. | ||
(Although this cannot be verified in the formalization of ConSORT.) | ||
*/ | ||
|
||
{ | ||
let x = mkref 1 in | ||
let y = x in | ||
let x1 = *x in | ||
let x2 = *x in { | ||
y := 2; | ||
assert(x1 = x2) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
Test that nothing is wrongly havocked. | ||
*/ | ||
|
||
create_list() { | ||
if _ then | ||
null | ||
else | ||
let tail = create_list() in | ||
let tup = (1, tail) in | ||
mkref tup | ||
} | ||
|
||
{ | ||
let l = create_list() in | ||
let (v1, l1) = *l in | ||
{ | ||
alias(l1 = (*l).1); | ||
let (v2, _) = *l in | ||
assert(v2 = 1) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters