[PATCH] D14203: [analyzer] Improve pointer arithmetic checker.

Gábor Horváth via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 12 01:20:20 PST 2015


xazax.hun added a comment.

In http://reviews.llvm.org/D14203#287303, @dcoughlin wrote:

> Gabor,
>
> This is an alpha checker. Do you anticipate turning it on by default?
>
> Comments inline.


I could see two kinds of false positives with this checker when running this on the LLVM codebase.

When objects are allocated in a way that one object is allocated together with an array (the array is after the original object in), and the object contains getter code like:

  reinterpret_cast<Elements*>(this + 1);

When a function is written like this:

  Obj* f() {
  if (opaqueCond)
      return singleObject;
  return array;
  }

And used like this:

  f()[5];

Other then these two cases I think the results are good.


http://reviews.llvm.org/D14203





More information about the cfe-commits mailing list