Re: pgsql: Fix valgrind failure

From: Álvaro Herrera <alvherre(at)kurilemu(dot)de>
To: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
Cc: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: Re: pgsql: Fix valgrind failure
Date: 2026-04-07 13:29:34
Message-ID: 202604071325.oar274bbljbq@alvherre.pgsql
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Hello,

On 2026-Apr-07, Bertrand Drouvot wrote:

> - SerializedSnapshotData serialized_snapshot;
> + SerializedSnapshotData serialized_snapshot = {0};
>
> Should we use memset() instead? As "= {0}" is guaranteed to zero padding bytes
> (for object that has automatic storage duration) as of C23 (see Andres's reply
> in [0]) but we require C11 so far.

Hmm ... I'll wait for skink to fail with the fix that was committed,
before making further changes. It may well be that it works okay as it
is now.

> I wonder if we should introduce a new macro say "INITIALIZE_PADDING"
> that I proposed in [1].
>
> [1]: https://postgr.es/m/ablMZvnGhX8h5GgK%40ip-10-97-1-34.eu-west-3.compute.internal

It's not clear to me how that would be used exactly (surely it needs to
be part of the initialization? But what if you have to use memset?), but
the idea looks rather ugly.

--
Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/

In response to

Browse pgsql-committers by date

  From Date Subject
Next Message Álvaro Herrera 2026-04-07 13:34:14 pgsql: doc: Add an example of REPACK (CONCURRENTLY)
Previous Message Heikki Linnakangas 2026-04-07 13:26:13 pgsql: Tidy up #ifdef USE_INJECTION_POINTS guards