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 1u5CBW-00DhpS-Eb for pgsql-hackers@arkaria.postgresql.org; Wed, 16 Apr 2025 23:28:50 +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 1u5CBU-008JQl-KC for pgsql-hackers@arkaria.postgresql.org; Wed, 16 Apr 2025 23:28:49 +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 1u5CBU-008JQ1-An for pgsql-hackers@lists.postgresql.org; Wed, 16 Apr 2025 23:28:49 +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 1u5CBT-000RnV-0J for pgsql-hackers@lists.postgresql.org; Wed, 16 Apr 2025 23:28:48 +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 53GNSiEA2087557; Wed, 16 Apr 2025 19:28:44 -0400 From: Tom Lane To: Jacob Champion cc: Daniel Gustafsson , pgsql-hackers@lists.postgresql.org Subject: Re: jsonapi: scary new warnings with LTO enabled In-reply-to: References: <2074634.1744839761@sss.pgh.pa.us> <0A3CF5C4-9947-42E3-89A9-34FCF7BA95BA@yesql.se> <2078511.1744841564@sss.pgh.pa.us> <2084687.1744844690@sss.pgh.pa.us> Comments: In-reply-to Jacob Champion message dated "Wed, 16 Apr 2025 16:09:40 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <2087555.1744846124.1@sss.pgh.pa.us> Content-Transfer-Encoding: 8bit Date: Wed, 16 Apr 2025 19:28:44 -0400 Message-ID: <2087556.1744846124@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Jacob Champion writes: > On Wed, Apr 16, 2025 at 4:04 PM Tom Lane wrote: >> Looking through all of the callers of freeJsonLexContext, quite >> a lot of them use local JsonLexContext structs, and probably some >> of them are more performance-critical than these. So that raises >> the question of why are we seeing warnings for only these call >> sites? > Yeah, I had the same question... After making another pass through the callers of freeJsonLexContext, I observe that the warnings appear in callers that use a local variable *and* contain goto statements. So I'm betting that the presence of goto's causes the LTO optimizer to pull in its horns quite a bit and thereby fail to detect the flag correlation. >> Maybe there is a more elegant way to suppress them. > Can we brute-force ignore this particular warning site with a #pragma > (suggested in [1])? That's surely not elegant :-(. However, I don't especially want to rewrite away the goto's in these callers ... regards, tom lane