bozicrHT wrote:
> I might be just tired to see, but why is this sound (correct) to do?
With this patch, we keep the original region and add a zero-offset view of the
target type.
Lets say that we have `unsigned char *q = a+i;` and `char *r = (char *)q;`, `q`
is modeled as `Element{a, i, unsigned char}`. Currently, the cast cannot
flatten symbolic `i`, so it becomes `UnknownVal` and may later be represented
by an conjured pointer, losing its relationship with `q`. With the patch, `r`
is conceptually `Element{Element{a, i, unsigned char}, 0, char}`. The zero
applies only to the new cast view; the symbolic index i remains unchanged. So,
`r` has the same address and nullness as `q`, but the correct target type.
https://github.com/llvm/llvm-project/pull/221213
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits