Re: pgsql: Fix up misuse of "volatile" in contrib/xml2. - Mailing list pgsql-committers

From Jacob Champion
Subject Re: pgsql: Fix up misuse of "volatile" in contrib/xml2.
Date
Msg-id CAOYmi+nqgJ9spHTW1dySe=mWtLL07mMY6Z4pzfT2sV+MrNYZFA@mail.gmail.com
Whole thread Raw
In response to Re: pgsql: Fix up misuse of "volatile" in contrib/xml2.  (Michael Paquier <michael@paquier.xyz>)
Responses Re: pgsql: Fix up misuse of "volatile" in contrib/xml2.
List pgsql-committers
On Wed, Jul 9, 2025 at 8:55 PM Michael Paquier <michael@paquier.xyz> wrote:
>
> On Wed, Jul 09, 2025 at 11:49:55AM -0400, Tom Lane wrote:
> > Not sure.  Yesterday I saw such warnings from arowana,
> > boa, dhole, rhinoceros, and shelduck, eg
> >
> >  arowana       | 2025-07-08 04:54:18 | xpath.c:274:6: warning: 'workspace' may be used uninitialized in this
function[-Wmaybe-uninitialized] 
> >  arowana       | 2025-07-08 04:54:18 | xpath.c:319:6: warning: 'workspace' may be used uninitialized in this
function[-Wmaybe-uninitialized] 
> >  arowana       | 2025-07-08 04:54:18 | xpath.c:374:6: warning: 'workspace' may be used uninitialized in this
function[-Wmaybe-uninitialized] 
> >  arowana       | 2025-07-08 04:54:18 | ../../src/include/postgres.h:329:2: warning: 'result' may be used
uninitializedin this function [-Wmaybe-uninitialized] 
> >
> > Didn't look to try to figure out what the common factor
> > among these machines is, but I think all of them are somewhat
> > dated, which is depressing.  You'd hope that newer compilers
> > are more likely to find such issues, not less likely.
>
> They are all using some gcc 4.X flavor, most with -O2 but not all.
>
> And -Wmaybe-uninitialized is included in my default switches with a
> gcc 14, and there is nothing with several levels of optimizations
> applied, up to -O3.  :(

I think I remember that GCC has had historical problems with tuning
the false-positive:false-negative rates for `-Wmaybe-uninitialized`.
It's not super surprising to me that later versions aren't always
better at seeing specific problems, especially if users were
complaining that an earlier version was too sensitive...

--Jacob



pgsql-committers by date:

Previous
From: Aleksander Alekseev
Date:
Subject: Re: pgsql: injection_points: Add injection_points_list()
Next
From: Tom Lane
Date:
Subject: Re: pgsql: Fix up misuse of "volatile" in contrib/xml2.