Re: Postgresql and Clang Static Analyzer

From: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
To: Дилян Палаузов <dilyan(dot)palauzov(at)aegee(dot)org>
Cc: PostgreSQL Bugs List <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: Postgresql and Clang Static Analyzer
Date: 2017-05-07 12:37:56
Message-ID: alpine.DEB.2.20.1705071416510.3896@lancre
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-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.

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message zosrothko 2017-05-07 13:25:02 Re: BUG #14633: ecpg : nothing is generated when using option -v
Previous Message Дилян Палаузов 2017-05-07 11:08:42 Re: Postgresql and Clang Static Analyzer