Re: [BUGS] Postgresql and Clang Static Analyzer - Mailing list pgsql-bugs

From Fabien COELHO
Subject Re: [BUGS] Postgresql and Clang Static Analyzer
Date
Msg-id alpine.DEB.2.20.1705071416510.3896@lancre
Whole thread Raw
In response to Re: [BUGS] Postgresql and Clang Static Analyzer  (Дилян Палаузов<dilyan.palauzov@aegee.org>)
List 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.


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

pgsql-bugs by date:

Previous
From: Дилян Палаузов
Date:
Subject: Re: [BUGS] Postgresql and Clang Static Analyzer
Next
From: zosrothko
Date:
Subject: Re: [BUGS] BUG #14633: ecpg : nothing is generated when using option-v