Re: PgStat_HashKey padding issue when passed by reference - Mailing list pgsql-hackers

From Sami Imseih
Subject Re: PgStat_HashKey padding issue when passed by reference
Date
Msg-id CAA5RZ0sOkyubFPJzZ_Sv4sdBV89C6WTDAc-B8ZE_-bTk8ggViA@mail.gmail.com
Whole thread Raw
In response to Re: PgStat_HashKey padding issue when passed by reference  (Andres Freund <andres@anarazel.de>)
Responses Re: PgStat_HashKey padding issue when passed by reference
List pgsql-hackers
> > This looks like a compiler bug, we tested multiple ways to workaround:
>
> Padding bytes aren't guaranteed to be zeroed, unless you take care to zero
> them out with memset or such. That's not a compiler bug.

Perhaps calling this a compiler bug is not appropriate.
However, memset is in fact called when the key is created

```
  /* clear padding */
  memset(&key, 0, sizeof(struct PgStat_HashKey));
```

but the zeroed out padding bytes are not retained when the
key is passed by value. This is why the proposal is to pass the
key by reference.

--
Sami Imseih
Amazon Web Services (AWS)



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: PgStat_HashKey padding issue when passed by reference
Next
From: vignesh C
Date:
Subject: Re: Logical Replication of sequences