[PATCH] D115932: [Analyzer] Create and handle SymbolCast for pointer to integral conversion
Artem Dergachev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Dec 17 13:13:07 PST 2021
NoQ added a comment.
Oh nice, it's great to see these things moving.
I have a couple observations for your specific approach:
(1) Sounds like you're introducing a symbol `(long p)` that represents the exact same value as (and is used interchangeably with) `&SymRegion{$p} (as long)`. Ambiguity is generally bad because it means a lot of duplication and missed cornercases.
(2) I think you can run into the same problem with a non-symbolic region which you can't unwrap the same way because there's no symbol to cast:
void foo() {
int p;
12 - (long)&p;
}
Maybe we should stick to your approach as strictly superior and eliminate `LocAsInteger` entirely? In this case the example (2) will work through introducing a new custom symbol `SymbolRegionAddress` which would look like `$addr<int p>`. Then add a hard canonicalization rule `SymRegion{$addr<R>} = R` (symregions around address symbols are ill-formed). Ideally we'd also have to unwrap offsets, i.e. `$addr{Element{x, char, $i}} = $addr<x> + $i`.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D115932/new/
https://reviews.llvm.org/D115932
More information about the cfe-commits
mailing list