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 1u5B5d-00DS9o-Lp for pgsql-hackers@arkaria.postgresql.org; Wed, 16 Apr 2025 22:18:42 +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 1u5B5b-006tIY-Di for pgsql-hackers@arkaria.postgresql.org; Wed, 16 Apr 2025 22:18:40 +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 1u5B5b-006tFw-0k for pgsql-hackers@lists.postgresql.org; Wed, 16 Apr 2025 22:18:39 +0000 Received: from smtp.outgoing.loopia.se ([93.188.3.37]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1u5B5Y-000RJt-1g for pgsql-hackers@lists.postgresql.org; Wed, 16 Apr 2025 22:18:38 +0000 Received: from s807.loopia.se (localhost [127.0.0.1]) by s807.loopia.se (Postfix) with ESMTP id B478A326F11 for ; Thu, 17 Apr 2025 00:18:34 +0200 (CEST) Received: from s979.loopia.se (unknown [172.22.191.5]) by s807.loopia.se (Postfix) with ESMTP id 90339324FFF; Thu, 17 Apr 2025 00:18:34 +0200 (CEST) Received: from s474.loopia.se (unknown [172.22.191.6]) by s979.loopia.se (Postfix) with ESMTP id 8E23810BC3A7; Thu, 17 Apr 2025 00:18:34 +0200 (CEST) X-Virus-Scanned: amavisd-new at amavis.loopia.se X-Spam-Flag: NO X-Spam-Score: -1.2 X-Spam-Level: X-Spam-Status: No, score=-1.2 tagged_above=-999 required=6.2 tests=[ALL_TRUSTED=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1] autolearn=disabled Authentication-Results: s474.loopia.se (amavisd-new); dkim=pass (2048-bit key) header.d=yesql.se Received: from s979.loopia.se ([172.22.191.6]) by s474.loopia.se (s474.loopia.se [172.22.190.14]) (amavisd-new, port 10024) with LMTP id bnAJaMgRLBJR; Thu, 17 Apr 2025 00:18:34 +0200 (CEST) X-Loopia-Auth: user X-Loopia-User: daniel@yesql.se X-Loopia-Originating-IP: 89.255.232.193 Received: from smtpclient.apple (customer-89-255-232-193.stosn.net [89.255.232.193]) (Authenticated sender: daniel@yesql.se) by s979.loopia.se (Postfix) with ESMTPSA id 2804110BC3BE; Thu, 17 Apr 2025 00:18:34 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yesql.se; s=loopiadkim1707475645; t=1744841914; bh=tymvX7qayNE5/sItRhoKaVvFwDz5Dp97qvF9Ya4+sJQ=; h=Subject:From:In-Reply-To:Date:Cc:References:To; b=pW6DHu0d3jnuTb9PvcMiEELUCzwCPc66r9j/58vS/0UIQIzMP10ThERWMUM9wDaKl H3jeRbiQ/UWWkAmiTwxzPbWwvtCPI7WYzNhAgvniRlFsDSlJ79mfGkxIBEoMrhxxiP ygqDEFZX7mmh+hI7vJMV7m7C0MD7egdxcf//qs4Cy8/98kmY7ueVVIY5+ZLImyfSAI mGeiJ/+zdFIOWoWie1fqJ0QPWdMklS+mkIOx6XRAd7+sPfg7xgmo5U+jkjyxFtIylD g2mja2K+ndTa5GF6eNRqxIY0dkSjCZbNbxD5W/+8KXofC8jbnEoQsyP7YXSTv0J9bs 85YQ7rHeY74qg== Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3776.700.51.11.1\)) Subject: Re: jsonapi: scary new warnings with LTO enabled From: Daniel Gustafsson In-Reply-To: <2078511.1744841564@sss.pgh.pa.us> Date: Thu, 17 Apr 2025 00:18:23 +0200 Cc: pgsql-hackers@lists.postgresql.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <2074634.1744839761@sss.pgh.pa.us> <0A3CF5C4-9947-42E3-89A9-34FCF7BA95BA@yesql.se> <2078511.1744841564@sss.pgh.pa.us> To: Tom Lane X-Mailer: Apple Mail (2.3776.700.51.11.1) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On 17 Apr 2025, at 00:12, Tom Lane wrote: >=20 > Daniel Gustafsson writes: >>> On 16 Apr 2025, at 23:42, Tom Lane wrote: >>> I'm not sure >>> how other than giving up on stack allocation of JsonLexContexts, >>> though, especially if we consider the jsonapi API frozen. But = seeing >>> that there are only three such call sites and none of them seem in = the >>> least performance-critical, maybe we should just do that? >=20 >> I can't see any other option really, and there is no performance = angle really >> so that should be safe. Since I committed at least one of these, let = me know >> if you want me to tackle it. >=20 > The only alternative I can see that might stop the warning is if we > can find a way to make it clearer to the optimizer that the FREE() > isn't reached. But I'm not sure about a trustworthy way to make that > happen. Maybe it'd work to change the signature of freeJsonLexContext > (or perhaps better, add a separate entry point) so that the caller is > passing a bool constant that controls whether to free the struct. > We could have an Assert that compares that to the state of the > JSONLEX_FREE_STRUCT flag to catch mistakes. This seems kind of messy > though. Yeah, that seems messy enough that someone down the line will go "why on = earth" and we'll have to revisit this discussion. It can probably be made to = work but I doubt it will be worth it compared to allocating on the heap. -- Daniel Gustafsson