[clang] [Clang] Generate the GEP instead of adding AST nodes (PR #73730)
Eli Friedman via cfe-commits
cfe-commits at lists.llvm.org
Tue Dec 5 14:58:20 PST 2023
efriedma-quic wrote:
Trying to discuss both __bdos and the array bounds sanitizer changes in the same review is making things confusing to discuss. It seems like they have significant differences.
For array bounds sanitizer, take your example:
```
struct s {
struct s *p;
int count;
int array[] __attribute__((count));
};
int foo(struct s *p, int index) {
return p->p->p->array[index];
}
```
When we visit the ArraySubscriptExpr, without sanitization, we call EmitLValue on `p->p->p->array`. My proposal is that, when we're doing sanitization, we don't do that. Instead, we call EmitPointerWithAlignment on `p->p->p`, then use the returned pointer to load `count` and index to `array`.
https://github.com/llvm/llvm-project/pull/73730
More information about the cfe-commits
mailing list