Re: pgsql: Fix up misuse of "volatile" in contrib/xml2.

From: Jacob Champion <jacob(dot)champion(at)enterprisedb(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: Re: pgsql: Fix up misuse of "volatile" in contrib/xml2.
Date: 2025-07-10 17:21:51
Message-ID: CAOYmi+nqgJ9spHTW1dySe=mWtLL07mMY6Z4pzfT2sV+MrNYZFA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

On Wed, Jul 9, 2025 at 8:55 PM Michael Paquier <michael(at)paquier(dot)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 uninitialized in 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

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2025-07-10 17:27:59 Re: pgsql: Fix up misuse of "volatile" in contrib/xml2.
Previous Message Aleksander Alekseev 2025-07-10 10:24:48 Re: pgsql: injection_points: Add injection_points_list()