Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xABRS-00000002Ux8-0tc7 for pgsql-hackers@arkaria.postgresql.org; Fri, 25 Sep 2026 19:18:42 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.98.2) (envelope-from ) id 1xABRR-00000002LGA-0zfb for pgsql-hackers@arkaria.postgresql.org; Fri, 25 Sep 2026 19:18:41 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xABRQ-00000002LG1-3wOz for pgsql-hackers@lists.postgresql.org; Fri, 25 Sep 2026 19:18:40 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xABRN-00000001FD8-3BaM for pgsql-hackers@lists.postgresql.org; Fri, 25 Sep 2026 19:18:40 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.18.1/8.18.1) with ESMTP id 68PJIa7b2012820; Fri, 25 Sep 2026 15:18:36 -0400 From: Tom Lane To: Ayush Tiwari cc: pgsql-hackers@lists.postgresql.org Subject: Re: Cleaning up pgcrypto/crypt-des.c to avoid compiler warnings In-reply-to: References: <2005885.1790359097@sss.pgh.pa.us> Comments: In-reply-to Ayush Tiwari message dated "Sat, 26 Sep 2026 00:07:30 +0530" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2012818.1790363916.1@sss.pgh.pa.us> Date: Fri, 25 Sep 2026 15:18:36 -0400 Message-ID: <2012819.1790363916@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Ayush Tiwari writes: > On Fri, 25 Sept 2026 at 23:28, Tom Lane 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