Re: Clang 3.3 Analyzer Results

From: Jeffrey Walton <noloader(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Clang 3.3 Analyzer Results
Date: 2013-11-12 20:17:18
Message-ID: CAH8yC8knrbE2r=g=oEri739SQnuMnZjWhoY09-Pz40Nu+8pWXw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

On Tue, Nov 12, 2013 at 9:38 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> ...
>
> One thought for the Clang people is that most of the reports such as "null
> pointer dereference" presumably mean "I think I see an execution path
> whereby we could get here with a null pointer". If so, it'd be awfully
> helpful if the complaint included some description of what that path is.
> I think Coverity does that, or at least I've seen output from some tool
> that does it.
Clang can be trained with asserts.

If you are certain that a parameter cannot be NULL, then pass the
knowledge onto Clang: assert(param != NULL). Clang will stop analyzing
that path for NULL-ness.

Or, you could check it for NULL and fail the function if the param is
NULL. If its a spurious test, then the optimizer will remove it.

Jeff

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andres Freund 2013-11-12 20:25:32 Re: Clang 3.3 Analyzer Results
Previous Message Francisco Figueiredo Jr. 2013-11-12 18:36:46 Re: GSSAPI server side on Linux, SSPI client side on Windows

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2013-11-12 20:25:32 Re: Clang 3.3 Analyzer Results
Previous Message Teodor Sigaev 2013-11-12 19:33:49 GIN bugs in master branch