Commit a96c85a7 authored by Christoph Reichenbach's avatar Christoph Reichenbach
Browse files

WIP fixing

parent 5e1ec053
......@@ -120,7 +120,7 @@ If you wish, you an omit `NA`, `NO`, and `NI` output in cases where the variable
If you analyze the following file:
```
type Pair(fst : nonnull int, snd : int);
type Trpl(fst : nonnull int, snd : int, trd : nonnull int);
fun null_producer(n : int) = {
if (n == 0) {
......@@ -130,7 +130,7 @@ fun null_producer(n : int) = {
}
fun main(n : int) : nonnull int = { // line 10
var p : Pair := new Pair(0, 1);
var p : Trpl := new Trpl(0, 1, 2);
p.snd := null;
p.fst := null_producer(n);
return p.fst;
......@@ -143,15 +143,21 @@ Your analysis should print the following:
N 14 4 -> null 12 13
N 14 4 -> obj 11 29
N 14 4 -> obj 11 32
N 14 4 -> obj 11 35
N 14 4 -> null 5 14
N 1 10 -> null 12 13
N 1 10 -> null 5 14
N 1 10 -> obj 11 29
N 1 10 -> obj 11 32
N 1 10 -> obj 11 35
```
Where:
- `N` means that we are talking about an assignment to a nonnull variable (here, a field).
- `14 4` refers to the source location that Teal associates with the initial field assignment
- `obj 6 29` refers to the literal number `5`
- `8 4` is the source location of the second assignment
- `null 3 50` is the source location in which `null` occurs in `null_producer` (from which it can make its way into `p.fst`).
- `14 4` refers to the source location that Teal associates with the `return` statement
- `1 10` refers to the source location that Teal associates with the `fst` field. Since we don't expect a field-sensitive analysis, it is fine to point to _any_ nonnull field (i.e., it would also be okay to report the location of `trd`).
- `obj 11 35` refers to the literal number `2`
- `null 5 14` is the source location in which `null` occurs in `null_producer` (from which it can make its way into `p.fst`).
Note that `p.fst` will not point to `n`: the content of `n` will flow into `p.fst`, however; in Andersen's analysis,
this translates into an inclusion edge (after some steps of analysis). Since nothing in this code calls `main`, we can't see what `n` will point
......
N 4 6 -> obj 14 4
NI 5 9 -> null 9 25
NI 5 9 -> obj 9 21
N 10 2 -> null 12 7
N 10 2 -> obj 9 15
NI 5 9 -> obj 9 21
NI 5 9 -> null 9 25
NO 16 9 -> null 12 7
NO 16 9 -> obj 9 15
N 14 4 -> null 12 13
N 14 4 -> null 5 14
N 14 4 -> obj 11 29
N 14 4 -> obj 11 32
N 14 4 -> null 5 14
N 1 10 -> null 12 13
N 1 10 -> null 5 14
N 1 10 -> obj 11 29
N 1 10 -> obj 11 32
N 8 2 -> null 4 31
N 8 2 -> obj 4 17
N 8 2 -> obj 4 25
N 8 2 -> obj 4 28
N 8 2 -> obj 5 7
N 8 2 -> null 4 31
N 8 2 -> obj 5 15
N 8 2 -> obj 5 18
N 8 2 -> obj 5 7
N 8 2 -> obj 4 25
N 8 2 -> obj 4 28
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment