Re: jsonapi: scary new warnings with LTO enabled - Mailing list pgsql-hackers

From Tom Lane
Subject Re: jsonapi: scary new warnings with LTO enabled
Date
Msg-id 2087556.1744846124@sss.pgh.pa.us
Whole thread Raw
In response to Re: jsonapi: scary new warnings with LTO enabled  (Jacob Champion <jacob.champion@enterprisedb.com>)
Responses Re: jsonapi: scary new warnings with LTO enabled
List pgsql-hackers
Jacob Champion <jacob.champion@enterprisedb.com> writes:
> On Wed, Apr 16, 2025 at 4:04 PM Tom Lane <tgl@sss.pgh.pa.us> 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



pgsql-hackers by date:

Previous
From: Noah Misch
Date:
Subject: Re: pipelining in psql, commit 41625ab
Next
From: David Rowley
Date:
Subject: Re: Fixup some appendPQExpBuffer() calls