vsavchenko added a comment.

In D103096#2867104 <https://reviews.llvm.org/D103096#2867104>, @ASDenysPetrov 
wrote:

> Generally, with this patch we kinda have several constraints for each cast of 
> a single symbol. And we shall care for all of that constraints and timely 
> update them (if possible).
> For instance, we have `int x` and meet casts of this symbol in code:
>
>   int x;
>   (char)x; // we can reason about the 1st byte
>   (short)x; // we can reason about the 2 lowest bytes
>   (ushort)x; // we can reason about the 2 lowest bytes (in this case we may 
> not store for unsigned separately, as we already stored 2 bytes for signed)
>
> That's like we have a knowledge of a lower //part// of the integer. And every 
> time we have a new constraints, for example, for `(short)x;` (aka 2 bytes) 
> then we have to update all the constraints that have two bytes or lower 
> (`(char)x`in this case) as well to make them consistent.

What we do in `Inferrer` is that we try to look at many sources of information 
and `intersect` their ranges.  And I repeat my question again in a bit 
different form, why can't it look up constraints for `(char)x` and for 
`(short)x` and intersect them?
You should admit you never really address this question.  Why can't 
`VisitSymolCast` do everything?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D103096/new/

https://reviews.llvm.org/D103096

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to