Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d7LTt-0007lu-82 for pgsql-bugs@arkaria.postgresql.org; Sun, 07 May 2017 12:40:09 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1d7LTs-0003TO-R6 for pgsql-bugs@arkaria.postgresql.org; Sun, 07 May 2017 12:40:08 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1d7LTB-0001cU-Me for pgsql-bugs@postgresql.org; Sun, 07 May 2017 12:39:25 +0000 Received: from jiboia.ensmp.fr ([194.214.158.138] helo=cc-tupan-roaming-a.ensmp.fr) by magus.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d7LT6-0006sE-Pb for pgsql-bugs@postgresql.org; Sun, 07 May 2017 12:39:23 +0000 Received: from cri.ensmp.fr (232.200.219.88.rev.sfr.net [88.219.200.232]) (authenticated bits=0) by cc-tupan-roaming-a.ensmp.fr (8.15.2/8.15.2/JMMC-22/Oct/2013) with ESMTPSA id v47Cc1dA028135 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sun, 7 May 2017 14:38:02 +0200 Date: Sun, 7 May 2017 14:37:56 +0200 (CEST) From: Fabien COELHO X-X-Sender: fabien@lancre To: =?KOI8-R?B?5MnM0c4g8MHMwdXaz9c=?= cc: PostgreSQL Bugs List Subject: Re: Postgresql and Clang Static Analyzer In-Reply-To: <5d5ae226-bee4-9c0f-34ce-755a0e1205a4@aegee.org> Message-ID: References: <5d5ae226-bee4-9c0f-34ce-755a0e1205a4@aegee.org> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed X-Miltered: at cc-tupan-roaming-a.ensmp.fr with ID 590F1529.000 by Joe's j-chkmail (http : // j-chkmail dot ensmp dot fr)! X-j-chkmail-Auth: USER-ID fabien.coelho X-j-chkmail-Enveloppe: 590F1529.000 from 232.200.219.88.rev.sfr.net/232.200.219.88.rev.sfr.net/88.219.200.232/cri.ensmp.fr/ X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org 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