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 1xAB8F-00000002Umf-2N3x for pgsql-hackers@arkaria.postgresql.org; Fri, 25 Sep 2026 18:58:51 +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 1xAB8E-00000002HNb-3cH9 for pgsql-hackers@arkaria.postgresql.org; Fri, 25 Sep 2026 18:58:50 +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 1xAB4a-00000002E7M-0VRc for pgsql-hackers@lists.postgresql.org; Fri, 25 Sep 2026 18:55:04 +0000 Received: from mail-qk2-x10.google.com ([2607:f8b0:4864:34::10]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1xAB4X-00000001F2a-3DHv for pgsql-hackers@lists.postgresql.org; Fri, 25 Sep 2026 18:55:03 +0000 Received: by mail-qk2-x10.google.com with SMTP id af79cd13be357-939109fafd7so101596085a.2 for ; Fri, 25 Sep 2026 11:55:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1790362501; x=1790967301; darn=lists.postgresql.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=7ijojT/ZueTgAilGNbaxo4aAYO2Jf9s+2eSBEqbCDRE=; b=BIKJlTSf4u4jIRxbCV/fzCRr7+Z7d3FJqA7YUBx3S2C/VYmlA4fVGk/KtRcAvtiadb jlw5MbFX14Tj9ZF82ttlZ5A3De5VUki4u+8wY6AZ5HUicspY4/ADQVMlXIWcvtighgb7 DexCcnSvQDa6ELAZTyH9r6ShL39bd0BUZVhrBOagbQjNBJ4Y5tancruqV/qHSxUDZdE8 4MhumwypJLoxk5EQfvfT87GSQ85KdZ90cKeAtRogf8Tt8twNkaHnp6LvrunbHSkH3k/U FkYp44CtNuOiDvKt3zGytcDAp5XBEOMJI1aoEW4jH6g0tUcE1/QC3Q90D/2pFe9VDIFG +SuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790362501; x=1790967301; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=7ijojT/ZueTgAilGNbaxo4aAYO2Jf9s+2eSBEqbCDRE=; b=ABWoVeCZy5fuzjtYCXMgw91/KUUlhKwDuwkXBuo8+bC5H0cCf4Be74WRSM91yrarE3 f97zra7U4r1jiUUZCRybakH7rRI+zbflvWxU3B0RqF9mvHfu79NXQuMj+H0bFeKr+Nb7 tCqMTftfZNjcqaGdURkby9HertS1Uteuk1hgMuR9n1Vua2We9qX4nWq8ZgfKX5VtbCRx U/KPsSVzk1F72a4F2u7t0xJdfKG0BDbxh6DGxeAoINpNbhp0h9Hxw+9pxCX6Vk0a7G9g HGkuQSCRBj6noFTY18rS0/p02sNp8JMHil7EXGAjPw03hLOSrv3oCAC+FWwCPPtgIyjQ j8wQ== X-Gm-Message-State: AFuF++lrOJ1iOdO+f79lW/f5AQfss2CqUH39GpHvz7eTbd+DF/F2Bqtc JNSvvwjOc5fXDgdk2UdQ0jOKvHYPeV0JF5ChhIvoB9rJjKvitkjiFTsx X-Gm-Gg: AYBFou3fhzvO7Ktn3G+4+dyU7NQs//eFeAIYcwav8h4Q96t9l3n5NYiwIZiGjs0Z7Oh D6svpZXP7tULLd9d4s8R2A3XlNXziPp7JkDwrthdvZo0IL6e04xGph51K+/ZHrhSd1M7d5TpxJ2 a68lvKxra/h6obrmxUayUQm6Vv2EaCDQO16jsiHj8GsqWAZfLJURWA9HxGrlJLPNOcnXW66cJDW RAHN/7IO/KGe9yZEnrILAZsWg8UPLGE7f5TP6Qwtd/CBHWDZpFpTXm2NqnM1j1KlN42vsp3kPb3 wq9P1JpVeVeJVGssG6pRMPtLVUO+M1jGSJToLd8D5V0hLQsZGuqiom9uYudOS061GQe+9w1x/Li CY129HNG/O21cgdgJYb+0fgqSY6BqUd4UrZrWzzuE30G/t6+KN02D59FQhQs5y8BTVyyN7Dk8c7 jdWKquRGV/Pd0CiEv7gNBW/AH8YFW2R3caBjJ10/RV3E6XVA/+J76BApIbdrmvQ7LqW3v+3A5x9 yJTLMomzP49bFUlBAMCAzIPLgyOduzTae5Sb96Y1ecmdaYDw71qLFuxbzT+rB1klsZOawOqqMH/ tkV3DQEUY/+gef8jFgmwKNpN3A== X-Received: by 2002:a05:620a:708d:b0:939:8905:ce9b with SMTP id af79cd13be357-93c43bbc0d9mr580604785a.17.1790362501340; Fri, 25 Sep 2026 11:55:01 -0700 (PDT) Received: from nathan (162-195-168-172.lightspeed.stlsmo.sbcglobal.net. [162.195.168.172]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-91430dabc7bsm23256876d6.13.2026.09.25.11.55.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Sep 2026 11:55:00 -0700 (PDT) Date: Fri, 25 Sep 2026 13:54:58 -0500 From: Nathan Bossart To: Tom Lane Cc: pgsql-hackers@lists.postgresql.org Subject: Re: Cleaning up pgcrypto/crypt-des.c to avoid compiler warnings Message-ID: References: <2005885.1790359097@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2005885.1790359097@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, Sep 25, 2026 at 01:58:17PM -0400, Tom Lane wrote: > 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. Getting rid of the "q" variable altogether might have a better chance of clearing the warnings, and IMHO it further improves readability: > + q = &keybuf.bytes[0]; > + while (q < &keybuf.bytes[8]) > { > *q++ = *key << 1; for (i = 0; i < 8; i++) { keybuf.bytes[i] = *key << 1; > + q = &keybuf.bytes[0]; > + while (q < &keybuf.bytes[8] && *key) > *q++ ^= *key++ << 1; for (i = 0; i < 8 && *key; i++) keybuf.bytes[i] ^= *key++ << 1; -- nathan