# Causality Test Cases

See Bill Pugh's Causality Test cases list for the original list.
Here I describe variations on some of the contentious tests in that list.

## Causality test case 18a

Initially, x = y = 0
Thread 1:
r3 = x
if (r3 == 0)
x = 42
r1 = x
y = r1
Thread 2:
r2 = y
x = r2
Thread 3:
r4 = x
if (r4 == 71)
x = 71
Behavior in question: r1 == r2 == r3 == 42
Proposed Decision: Disallowed. (See Test 18 which is currently allowed.)

## Causality test case 18b

Initially, x = y = 0
Thread 1:
r3 = x
if (r3 == 0)
x = 41
if (r3 == 0)
x = 42
r1 = x
y = r1
Thread 2:
r2 = y
x = r2
Behavior in question: r1 == r2 == r3 == 42
Proposed Decision: Disallowed. (See Test 18 which is currently allowed.)

## Causality test case 18c

Initially, x = y = 0
Thread 1:
r3 = x
if (r3 == 41)
x = 41
if (r3 == 0)
x = 42
r1 = x
y = r1
Thread 2:
r2 = y
x = r2
Behavior in question: r1 == r2 == r3 == 42
Proposed Decision: Disallowed. (See Test 18 which is currently allowed.)