[PATCH] D103096: [analyzer] Implement cast for ranges of symbolic integers.

Denys Petrov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 9 07:55:04 PDT 2021


ASDenysPetrov added a comment.

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 met 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.


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

https://reviews.llvm.org/D103096



More information about the cfe-commits mailing list