Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wBzBR-001Yll-0m for pgsql-hackers@arkaria.postgresql.org; Sun, 12 Apr 2026 18:05:21 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wBzBP-002vN1-1J for pgsql-hackers@arkaria.postgresql.org; Sun, 12 Apr 2026 18:05:20 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wBzBP-002vMt-0N for pgsql-hackers@lists.postgresql.org; Sun, 12 Apr 2026 18:05:20 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wBzBN-00000000hsk-48tM for pgsql-hackers@postgresql.org; Sun, 12 Apr 2026 18:05:19 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 63CI52NL342013; Sun, 12 Apr 2026 14:05:02 -0400 From: Tom Lane To: Heikki Linnakangas cc: David Geier , Matthias van de Meent , pgsql-hackers Subject: Re: Reduce build times of pg_trgm GIN indexes In-reply-to: <6439c655-e281-409d-b884-6586750d5820@iki.fi> References: <5d366878-2007-4d31-861e-19294b7a583b@gmail.com> <9ac3931a-180e-4283-a7a8-05eb66099206@iki.fi> <2e11134f-02c3-43da-8c39-fb520a1a251d@iki.fi> <66620ec7-0f81-4813-9cf1-b901a56efcc3@gmail.com> <2a76b5ef-4b12-4023-93a1-eed6e64968f3@gmail.com> <6439c655-e281-409d-b884-6586750d5820@iki.fi> Comments: In-reply-to Heikki Linnakangas message dated "Tue, 07 Apr 2026 14:27:40 +0300" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <342011.1776017102.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Sun, 12 Apr 2026 14:05:02 -0400 Message-ID: <342012.1776017102@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Heikki Linnakangas writes: > Pushed 0001 as commit 6f5ad00ab7. This commit has caused Coverity to start complaining that most of ginExtractEntries() is unreachable: *** CID 1691468: Control flow issues (DEADCODE) /srv/coverity/git/pgsql-git/postgresql/src/backend/access/gin/ginutil.c: 4= 95 in ginExtractEntries() 489 /* 490 * Scan the items for any NULLs. All NULLs are considered equal,= so we 491 * just need to check and remember if there are any. We remove t= hem from 492 * the array here, and after deduplication, put back one NULL ent= ry to 493 * represent them all. 494 */ >>> CID 1691468: Control flow issues (DEADCODE) >>> Execution cannot reach this statement: "hasNull =3D false;". 495 hasNull =3D false; 496 if (nullFlags) 497 { 498 int32 numNonNulls =3D 0; 499 = 500 for (int32 i =3D 0; i < nentries; i++) Evidently, it does not realize that the extractValueFn() can change nentries from its initial value of zero. I wouldn't be too surprised if that's related to our casting of the pointer to uintptr_t --- that may cause it to not see the passed pointer as a potential reference mechanism. I would just write that off as Coverity not being smart enough, except that I'm worried that some compiler might make a similar deduction and break the function completely. Was the switch to a local variable for nentries really a useful win performance-wise? regards, tom lane