From: Fabien COELHO <coelho@cri.ensmp.fr>
To: Дилян Палаузов <dilyan.palauzov@aegee.org>
Cc: PostgreSQL Bugs List <pgsql-bugs@postgresql.org>
Subject: Re: Postgresql and Clang Static Analyzer
Date: Sun, 7 May 2017 14:37:56 +0200 (CEST)
Message-ID: <alpine.DEB.2.20.1705071416510.3896@lancre> (raw)
In-Reply-To: <5d5ae226-bee4-9c0f-34ce-755a0e1205a4@aegee.org>
References: <ec053d24-6471-13c2-d773-995dcc5747a6@aegee.org>
<CAFrbyQxs0kE26qBydVChNAe+2fi6=sBv8O_LfsCNmbzmgZMxcg@mail.gmail.com>
<d2ac5495-52f7-71d2-2768-d80655c51c1b@aegee.org>
<5d5ae226-bee4-9c0f-34ce-755a0e1205a4@aegee.org>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
Hello,
> and the output is at
> https://mail.aegee.org/dpa/scan-build-pg-628462bda9/
I had a quick look on 'src/bin/pgbench/pgbench.c' 4 warnings:
One seems indeed to be an unused assignment ("command" variable
assignment on line 2286) and could be removed, although a cleaner
solution would be to use per-block "command" variables instead of a shared
global one, but pg switch indentation rules would shift the code too much
to my taste.
The other three about undefined variables just demonstrate that clang does
not understand the code: it does not get that the argc counter counts
arguments so that it is fine to use the corresponding offsets (while loop
on 3301, uses afterwards).
The fact could be hidden from clang by zero filling the offset array to
make clang believe that the array is initialized, but that would be just
reassuring it without really improving anything.
None of these four issues are "bugs" in any sense, IMHO, they just proove
that static analysis can generate more noise than signal when applied
roughtly.
--
Fabien.
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: coelho@cri.ensmp.fr, dilyan.palauzov@aegee.org
Subject: Re: Postgresql and Clang Static Analyzer
In-Reply-To: <alpine.DEB.2.20.1705071416510.3896@lancre>
References: <ec053d24-6471-13c2-d773-995dcc5747a6@aegee.org> <CAFrbyQxs0kE26qBydVChNAe+2fi6=sBv8O_LfsCNmbzmgZMxcg@mail.gmail.com> <d2ac5495-52f7-71d2-2768-d80655c51c1b@aegee.org> <5d5ae226-bee4-9c0f-34ce-755a0e1205a4@aegee.org> <alpine.DEB.2.20.1705071416510.3896@lancre>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox