-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b9653ff
commit 2d816d0
Showing
41 changed files
with
597 additions
and
226 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#include <stdint.h> | ||
#include <assert.h> | ||
|
||
/* | ||
This test shows that we can read from uninitialized memory. | ||
EXPECTED: FAIL | ||
PREVIOUSLY: We returned PASS because the array read had no possible rf-edge and thus the program had no valid executions. | ||
*/ | ||
|
||
#define SIZE 10 | ||
volatile int array[SIZE]; | ||
|
||
int main() | ||
{ | ||
assert (array[SIZE] == 42); | ||
return 0; | ||
} |
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,128 @@ | ||
C "C++11" | ||
|
||
(* All c11_*.cat files are C11 models | ||
Overhauling SC atomics in C11 and OpenCL. | ||
M. Batty, A. Donaldson, J. Wickerson. In Proc. | ||
43rd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL), 2016. | ||
|
||
Rewritten by Luc Maranget for herd7 | ||
|
||
*) | ||
|
||
include "c11_cos.cat" | ||
include "c11_los.cat" | ||
|
||
let asw = IW * (M \ IW) | ||
let sb = po | ||
let mo = co | ||
|
||
let cacq = ACQ | (SC & (R | F)) | ACQ_REL | (F & CON) | ||
let crel = REL | (SC & (W | F)) | ACQ_REL | ||
let ccon = R & CON | ||
|
||
let fr = rf^-1 ; mo | ||
|
||
let dd = (data | addr)+ | ||
|
||
let fsb = sb & (F * _) | ||
let sbf = sb & (_ * F) | ||
|
||
(* release_acquire_fenced_synchronizes_with, | ||
hypothetical_release_sequence_set, | ||
release_sequence_set *) | ||
|
||
(* OLD: let rs = [crel] ; fsb? ; [A & W] ; | ||
(((mo ; [rmw]) | coi) & ~(coe ; [!rmw] ; mo))? *) | ||
|
||
let rs_prime = int | (_ * (R & W)) | ||
let rs = mo & rs_prime \ ((mo \ rs_prime) ; mo) | ||
|
||
(* OLD: let swra = ext (rs ; rf ; [A] ; sbf? ; [cacq]) *) | ||
let swra = | ||
ext & | ||
([crel] ; fsb? ; [A & W] ; rs? ; rf ; | ||
[R & A] ; sbf? ; [cacq]) | ||
|
||
//let swul = ext & ([UL] ; lo ; [LK]) | ||
let pp_asw = asw \ (asw ; sb) | ||
//let sw = pp_asw | swul | swra | ||
let sw = pp_asw | swra | ||
|
||
(* with_consume_cad_set, | ||
dependency_ordered_before *) | ||
let cad = ((rf & sb) | dd)+ | ||
let dob = | ||
(ext & | ||
([W & crel] ; fsb? ; [A & W] ; | ||
rs?; rf; [ccon])); | ||
cad? | ||
|
||
(* happens_before, | ||
inter_thread_happens_before, | ||
consistent_hb *) | ||
let ithbr = sw | dob | (sw ; sb) | ||
let ithb = (ithbr | (sb ; ithbr))+ | ||
let hb = sb | ithb | ||
acyclic hb as Hb | ||
|
||
(* coherent_memory_use *) | ||
let hbl = hb & loc | ||
|
||
irreflexive ((rf^-1)? ; mo ; rf? ; hb) as Coh | ||
|
||
(* visible_side_effect_set *) | ||
let vis = (hbl & (W * R)) \ (hbl; [W] ; hbl) | ||
|
||
(* consistent_atomic_rf *) | ||
irreflexive (rf ; hb) as Rf | ||
|
||
(* consistent_non_atomic_rf *) | ||
empty ((rf ; [R\A]) \ vis) as NaRf | ||
// NOTE FW is a dynamic tag which we don't yet support | ||
//empty [FW\A];hbl;[W] as NaRf (* implicit read of Na final writes.. *) | ||
|
||
irreflexive (rf | (mo ; mo ; rf^-1) | (mo ; rf)) as Rmw | ||
|
||
|
||
(* locks_only_consistent_lo *) | ||
//irreflexive (lo ; hb) as Lo1 | ||
|
||
(* locks_only_consistent_locks *) | ||
//irreflexive ([LS] ; lo^-1 ; [LS] ; ~(lo ; [UL] ; lo)) as Lo2 | ||
|
||
|
||
(* data_races *) | ||
//let Mutex = UL|LS | ||
//let cnf = (((W * _) | (_ * W)) & loc) \ ((Mutex * _) | (_ * Mutex)) | ||
//let dr = ext & (cnf \ hb \ (hb^-1) \ (A * A)) | ||
|
||
(* unsequenced_races *) | ||
//let ur = int & ((W * M) | (M * W)) & loc & ~id & ~(sb+) & ~((sb+)^-1) | ||
|
||
(* locks_only_good_mutex_use, locks_only_bad_mutexes *) | ||
|
||
//let bl = ([LS]; (sb & lo); [LK]) & ~(lo; [UL]; lo) | ||
|
||
//let losbwoul = (sb & lo & ~(lo; [UL]; lo)) | ||
|
||
//let lu = [UL] & ~([UL] ; losbwoul^-1 ; [LS] ; losbwoul ; [UL]) | ||
|
||
let r1 = hb | ||
let r2 = fsb? ; mo ; sbf? | ||
let r3 = rf^-1; [SC] ; mo | ||
let r4 = rf^-1 ; hbl ; [W] | ||
let r5 = fsb ; fr | ||
let r6 = fr ; sbf | ||
let r7 = fsb ; fr ; sbf | ||
|
||
let scp = r1|r2|r3|r4|r5|r6|r7 | ||
|
||
acyclic (((SC * SC) & scp) \ id) as Spartial | ||
|
||
//undefined_unless empty dr as Dr | ||
//undefined_unless empty ur as unsequencedRace | ||
//undefined_unless empty bl as badLock | ||
//undefined_unless empty lu as badUnlock | ||
|
||
// Atomicity | ||
empty rmw & (fre; coe) as atomic |
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
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
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
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
Oops, something went wrong.