pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Ayush Tiwari <ayushtiwari.slg01@gmail.com>
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: Cleaning up pgcrypto/crypt-des.c to avoid compiler warnings
Date: Fri, 25 Sep 2026 15:18:36 -0400
Message-ID: <2012819.1790363916@sss.pgh.pa.us> (raw)
In-Reply-To: <CAJTYsWUs8mPCpzULs4u8O5wDiNLVvmnOUvkZtO+DttKxbN+rZQ@mail.gmail.com>
References: <2005885.1790359097@sss.pgh.pa.us>
	<CAJTYsWUs8mPCpzULs4u8O5wDiNLVvmnOUvkZtO+DttKxbN+rZQ@mail.gmail.com>

Ayush Tiwari <ayushtiwari.slg01@gmail.com> writes:
> On Fri, 25 Sept 2026 at 23:28, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> For some time now, buildfarm member serinus has been complaining
>> about pgcrypto/crypt-des.c:
>> ...
>> I think this odd coding, perhaps combined with all the cowboy casting
>> that's going on here, is what's confusing gcc into giving a warning.
>> I propose the attached patch to make this code less ugly and (with
>> luck) suppress the warning.

> Yeah I agree that it's pretty ugly.
> We had an open patch for that obscure loop earlier[1].
> (I'll close that commitfest item)

Oh!  I'd missed that thread.  Thank you for pointing me to it, because
I had been unable to reproduce the warning, but now I know that it's
necessary to use -O3 along with a recent gcc to see it.  Armed with
that knowledge, I find that my patch does not suppress the warning :-(
I'll use this variant of your proposal instead:

	for (size_t q = 0; q < lengthof(keybuf.bytes); q++)
	{
		keybuf.bytes[q] = *key << 1;
		...


That does suppress the warning, at least with the gcc 16.2.1 that
I'm testing with.

Thanks for the review!

			regards, tom lane





view thread (5+ messages)  latest in thread

Message-ID: <2012819.1790363916@sss.pgh.pa.us>
Permalink:  ../2012819.1790363916@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/2012819.1790363916@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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, ayushtiwari.slg01@gmail.com
  Subject: Re: Cleaning up pgcrypto/crypt-des.c to avoid compiler warnings
  In-Reply-To: <2012819.1790363916@sss.pgh.pa.us>
  References: <2005885.1790359097@sss.pgh.pa.us> <CAJTYsWUs8mPCpzULs4u8O5wDiNLVvmnOUvkZtO+DttKxbN+rZQ@mail.gmail.com> <2012819.1790363916@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