| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | Peter Eisentraut <peter(at)eisentraut(dot)org> |
| Cc: | Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, David Geier <geidav(dot)pg(at)gmail(dot)com>, Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Re: Reduce build times of pg_trgm GIN indexes |
| Date: | 2026-04-15 21:25:24 |
| Message-ID: | 2197023.1776288324@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Peter Eisentraut <peter(at)eisentraut(dot)org> writes:
> On 15.04.26 13:06, Heikki Linnakangas wrote:
>> This was briefly discussed when PointerGetDatum() was changed from a
>> macro to a static inline function [1]. On that email, Peter pointed out
>> that the compiler was doing the same deduction that Coverity did now,
>> i.e. that if you pass the Datum returned by PointerGetDatum(&foo) to a
>> function, it cannot change *foo. I'm surprised we dismissed that worry
>> so quickly. If the compiler optimizes based on that assumption, you can
>> get incorrect code.
> I don't think this is in evidence. AFAICT, it's just Coverity that is
> complaining here, which is its right, but the code is not incorrect.
Are you sure? This seems like the sort of thing that will bite us on
the rear sometime in the future, as the compiler geeks put in more and
more aggressive optimizations.
I think we should at least test the theory that changing
PointerGetDatum to remove the const cast would silence Coverity's
complaint. If it does not then we're attributing too much
intelligence to Coverity. But if it does, then we've correctly
identified why it's complaining, and we should take seriously the
idea that they aren't the only ones making this sort of deduction
(or won't be for long).
regards, tom lane
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tristan Partin | 2026-04-15 21:33:41 | Re: Minor cleanup of Meson files given that we require 0.57 |
| Previous Message | Paul A Jungwirth | 2026-04-15 20:59:21 | Re: FOR PORTION OF does not recompute GENERATED STORED columns that depend on the range column |