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.94.2) (envelope-from ) id 1uNGc3-00FlX2-6S for pgsql-hackers@arkaria.postgresql.org; Thu, 05 Jun 2025 19:50:55 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1uNGc0-00DxuZ-6L for pgsql-hackers@arkaria.postgresql.org; Thu, 05 Jun 2025 19:50:52 +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.94.2) (envelope-from ) id 1uNGbz-00DxuQ-T3 for pgsql-hackers@lists.postgresql.org; Thu, 05 Jun 2025 19:50:52 +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.96) (envelope-from ) id 1uNGby-000RUB-2O for pgsql-hackers@lists.postgresql.org; Thu, 05 Jun 2025 19:50:51 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 555Jomie1317579; Thu, 5 Jun 2025 15:50:48 -0400 From: Tom Lane To: Andres Freund cc: pgsql-hackers@lists.postgresql.org Subject: Re: gcc 15 "array subscript 0" warning at level -O3 In-reply-to: References: <1985046.1745602635@sss.pgh.pa.us> <3prdb6hkep3duglhsujrn52bkvnlkvhc54fzvph2emrsm4vodl@77yy6j4hkemb> Comments: In-reply-to Andres Freund message dated "Wed, 04 Jun 2025 15:00:03 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1317577.1749153048.1@sss.pgh.pa.us> Date: Thu, 05 Jun 2025 15:50:48 -0400 Message-ID: <1317578.1749153048@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Andres Freund writes: >> I've been wondering about adding wrapping something like that in a >> pg_assume(expr) or such. > I've been once more annoyed by this warning. Here's a prototype for the > approach outlined above. Looks plausible by eyeball. I did notice a typo in the comment: + * pg_assume(expr) stats that we assume `expr` to evaluate to true. In assert s/stats/states/, I think you meant. regards, tom lane