Open shaobo-he opened 3 years ago
Consider this program,
#include "smack.h" #include <stdint.h> void foo(uint64_t p) { int* x = (int*)p; *x = 1; } int main(void) { int y = 0; foo((uint64_t)&y); assert(y == 1); return 0; }
SMACK reports a spurious error. This is because x points to a different region than &y.
x
&y
Follow-up: this is because RemovePtrToIntPass eliminates the ptrtoint operation but not inttoptr as well. So we have only one complicated node.
RemovePtrToIntPass
ptrtoint
inttoptr
One solution is to inline foo manually.
Consider this program,
SMACK reports a spurious error. This is because
x
points to a different region than&y
.