[clang] [TBAA] Don't emit pointer-tbaa for void pointers. (PR #122116)

Andrew Pinski via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 8 22:25:44 PST 2025


pinskia wrote:

Note GCC already treats `void*` as being compatiable with all other pointers and has since GCC 6 (when it started to disambiguates accesses to different pointers).  I don't think it is documented though.
Another example where clang/LLVM handles void pointers differently from GCC:
```
extern void abort(void);
int f(void *a, int **b, void *c)
{
  void **e = a;
  int d = **b;
  *e = c;
  return d + **b;
}
int main()
{
  int d = 1;
  int ff = 0;
  int *e = &d;
  if (f(&e, &e, &ff) != 1)
    abort();
}
```

https://github.com/llvm/llvm-project/pull/122116


More information about the cfe-commits mailing list