How to handle data nondeterminism in program analysis
int main()
{
int i = input();
if (i == 0)
...
else
...
}
Represent sets of input values abstractly
Example: $a =\{1, 2, 3\}$ $b = \{ x \mid x \text{ is even} \}$
int main()
{
int i = input();
if (i < 42)
... // i < 42
else
... // i >= 42
}
int x = input();
int y = x + 1;
if (y == 0) {
int c = 2 + 7;
}
int x = __lamp_any_i32();
int y = __lamp_add(x, 1);
if (__lamp_eq(y, 0)) { // nondeterministic
y = __lamp_assume(y == 0); // constrain y
int c = 2 + 7;
}
%%writefile simple.c
#include <lamp.h>
#include <stdio.h>
int main() {
int i = __lamp_any_i32("i");
if (i == 0) {
printf("reached: i == 0\n");
} else {
printf("reached: i != 0\n");
}
printf("---------------\n");
}
!lartcc unit simple.c -o simple
!./simple
%%writefile dataflow.c
#include <lamp.h>
#include <stdio.h>
#include <assert.h>
int main() {
int x = __lamp_lift(1, 3);
int y = __lamp_lift(5, 10);
int z = x + y;
int u = z - 1;
}
%%dot.canvas
dataflow
!lartcc interval -g dataflow.c -o dataflow
%%lart.simulator dataflow
run
parametrizable by domains:
domain of _characters_
domain of _indices_
int *x = malloc(sizeof(int));
int *y = malloc(sizeof(int));
if (uintptr_t(x) < uintptr_t(y))
error();
int *x = malloc(sizeof(int));
free(x);
int *y = malloc(sizeof(int));
if (x == y)
error();
&array[7]
location is starting address of array
, offset is 7
scalar domains - integers, floats
memory/pointer domains (location, offset)
generic domains
Executable Abstraction (Heňo)
LTL Domain (Heňo)
Domain Specific Abstractions & How to pick a good domain? (Hugo)
Runtime Domain Refinement (Palo)
Compositional Program Analysis & Invariant Generation using Program Abstraction (Jakub)
File System Abstraction & OS Interaction Abstraction (Robo)