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 1xPQq6-00000000f2j-3uBT for pgsql-bugs@arkaria.postgresql.org; Fri, 06 Nov 2026 20:47:12 +0000 Received: from localhost ([127.0.0.1]:41144 helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.98.2) (envelope-from ) id 1xPQq5-00000001YnF-2imR for pgsql-bugs@arkaria.postgresql.org; Fri, 06 Nov 2026 20:47:09 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]:34324) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xPQq5-00000001Yn7-1fMM for pgsql-bugs@lists.postgresql.org; Fri, 06 Nov 2026 20:47:09 +0000 Received: from mail.kestrel.institute ([137.184.40.160]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xPQq3-00000000hj8-19te for pgsql-bugs@lists.postgresql.org; Fri, 06 Nov 2026 20:47:09 +0000 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.kestrel.institute C8A4413B130 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kestrel.edu; s=20200925; t=1793998023; bh=NHIAr/0LqdXRuPsJDU36rP22SGI9Py7/Ky1UIM+S6r4=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=E7+NwNSyZD08/MpV51hfEdr02bz92KiVPfErfMRreMu2Dk24nYDEqLLm7AKv+EflQ mB2Z+wIeylxLhi2Qixs3/pTNOHaffpXv1Jh+exd+rS7487NByBEJA0LFW5l5K05G9Q e8g+/1kncTfZXGvrRTlnSRGod3yQlTHS2Nh6rK11fOvIaK4SOQcpqfRS+1WT9eaREe TrShiKZQszKdFjnDLstEOzkRJH+BqK/W/V2Cr+FTMg165od8gJDyZYSvj47pa0nuKp AYFbLrtCQPO020c+/nRE3ZZJ0I3CwCEfxjs6ovicGlsldwPHWLhKsFOLZgOqJJ+U3f O1Pml0+PKA10g== Received: from smtp.kestrel.edu (unknown [50.196.138.188]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.kestrel.institute (Postfix) with ESMTPSA id C8A4413B130; Fri, 6 Nov 2026 12:47:03 -0800 (PST) Received: from [192.168.86.66] (unknown [136.33.137.177]) by smtp.kestrel.edu (Postfix) with ESMTPSA id 501F5181296; Fri, 6 Nov 2026 12:47:03 -0800 (PST) Message-ID: <7a0dc01d-a9fb-41e0-bc6a-38465e8f77e7@kestrel.edu> Date: Fri, 6 Nov 2026 14:47:02 -0600 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Incompatible declarations of pg_reg_getcolor() in regcomp.c and regexec.c To: Tom Lane Cc: pgsql-bugs@lists.postgresql.org References: <13a01caf-c4de-454e-aefa-92260aac7e64@kestrel.edu> <1905077.1793997140@sss.pgh.pa.us> From: Grant Jurgensen Content-Language: en-US In-Reply-To: <1905077.1793997140@sss.pgh.pa.us> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi Tom, Thanks for taking a look. To address your question, the C17 standard (6.2.7 p2) says:   All declarations that refer to the same object or function shall have compatible type; otherwise, the behavior is undefined. The undefined behavior comes from the declarations themselves, not from any access to the field. Other versions of the standard say the same thing. In practice you're right: neither pg_reg_getcolor() nor the executor ever touches colormap.v, so there is no observable issue, and my suggested rename doesn't change the compiled code at all. But it does remove behavior that is technically undefined, which matters for whole-program analysis tools that have to reconcile the two declarations of the same external function. And it's an easy fix. Thanks, -Grant On 11/6/26 2:32 PM, Tom Lane wrote: > Grant Jurgensen writes: >> The regex compiler and executor declare the external function >> pg_reg_getcolor() with incompatible types, which is undefined behavior >> under C17 6.2.7p2: > Since pg_reg_getcolor doesn't touch the colormap.v field, I'm > fairly confused about where there is any actual undefined behavior. > > regards, tom lane