pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Heikki Linnakangas <hlinnaka@iki.fi>
Cc: David Geier <geidav.pg@gmail.com>
Cc: Matthias van de Meent <boekewurm+postgres@gmail.com>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: Re: Reduce build times of pg_trgm GIN indexes
Date: Sun, 12 Apr 2026 14:05:02 -0400
Message-ID: <342012.1776017102@sss.pgh.pa.us> (raw)
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>
	<e5dd01c6-c469-405d-aea2-feca0b2dc34d@gmail.com>
	<2e11134f-02c3-43da-8c39-fb520a1a251d@iki.fi>
	<66620ec7-0f81-4813-9cf1-b901a56efcc3@gmail.com>
	<CAEze2WiUL9idZBbuUN+MuWqr6DcPr_-C91E9MTx=H62Xx5fHaQ@mail.gmail.com>
	<ef8782c9-68b7-4915-9f79-497765a8e205@gmail.com>
	<a90ebbbd-0d77-49c7-b222-3dbffa4e3b14@gmail.com>
	<2a76b5ef-4b12-4023-93a1-eed6e64968f3@gmail.com>
	<6439c655-e281-409d-b884-6586750d5820@iki.fi>

Heikki Linnakangas <hlinnaka@iki.fi> 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: 495             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 them from
492     	 * the array here, and after deduplication, put back one NULL entry to
493     	 * represent them all.
494     	 */
>>>     CID 1691468:         Control flow issues  (DEADCODE)
>>>     Execution cannot reach this statement: "hasNull = false;".
495     	hasNull = false;
496     	if (nullFlags)
497     	{
498     		int32		numNonNulls = 0;
499     
500     		for (int32 i = 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





view thread (51+ messages)  latest in thread

Message-ID: <342012.1776017102@sss.pgh.pa.us>
Permalink:  ../342012.1776017102@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/342012.1776017102@sss.pgh.pa.us

 · 

reply

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 using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, hlinnaka@iki.fi, geidav.pg@gmail.com, boekewurm+postgres@gmail.com
  Subject: Re: Reduce build times of pg_trgm GIN indexes
  In-Reply-To: <342012.1776017102@sss.pgh.pa.us>

* 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