This repository was archived by the owner on Jun 17, 2022. It is now read-only.

Description
The following compiles:
using <stdio.h>::{printf};
fn addr_of_local() int*
model safe(return)
{
int x = 12;
return &x;
}
fn deref(int *x) int
model *x == return
{
return *x;
}
export fn main() -> int {
int *ptr = addr_of_local();
int a = *ptr;
printf("a is %d\n", a);
int b = deref(ptr);
static_assert(a == b);
printf("%d == %d guaranteed by ZZ's static analysis\n", a, b);
return 0;
}
Here is an example output on my machine:
a is 12
12 == 2147450884 guaranteed by ZZ's static analysis
I love the concept behind ZZ, so I'm sad to have found such a gaping hole.