-
Notifications
You must be signed in to change notification settings - Fork 82
/
Copy pathdepds1.si
49 lines (39 loc) · 847 Bytes
/
depds1.si
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
algorithm test(input uint8 i,output uint8 o)
{
o = i;
}
algorithm main(output uint8 leds)
{
uint8 a = 0;
uint8 b = 0;
uint8 c = 0;
uint8 d = 0;
test tst;
subroutine sub(reads d,readwrites c) {
uint2 ivar = 1;
c = d + ivar;
return;
}
// b := 3; // this means b will always be _d_b in rvalues
// and we cannot write b = b + 1 anymore
// comment to resolve [3]
// ++: // uncomment to resolve [1]
b = a + 1;
c = b + 2;
a = c; /// [1] should trigger an error (init of a before, b depends on a)
tst <- (b);
d = c;
(a) <- tst;
c = b;
d = a;
if (a == 2) {
__display("a == 2");
}
++: // uncomment to resolve [2]
d = d + 1; /// [2] should trigger an error
() <- sub <- ();
++:
a = a + 1;
++:
b = b + 1; /// [3] should trigger an error if b := 3 is uncommented
}