[cfe-dev] New dereference pointer check
Jordan Rose
jordan_rose at apple.com
Mon Apr 28 15:42:59 PDT 2014
It's a good check, but it has all the same issues as the divide-by-zero check, at least. Let's get that one ironed out first.
On Apr 25, 2014, at 3:30 , Anders Rönnholm <Anders.Ronnholm at evidente.se> wrote:
> Hi,
>
> I intend to do a new dereference check. Much like the "division by zero then check" check i have started on.
>
> e.g
> void foo0(int *p, int a) {
> *p = 0;
> if (p == 0) {} // expected-warning {{Possible null pointer dereference: p - otherwise it is redundant to check it against null}}
> }
>
> I plan to do it the same way:
>
> 1. When a dereference is made store the value to the program state.
> 2. When reaching a condition that checks if a value is 0, check if the value has been dereferenced in the same scope previously.
> 3. Report bug
>
> Is this a check you would be interested in having?
>
> //Anders
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
More information about the cfe-dev
mailing list