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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: Re: pgsql: Fix up misuse of "volatile" in contrib/xml2.
Date: 2025-07-09 15:49:55
Message-ID: 1141878.1752076195@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Michael Paquier <michael(at)paquier(dot)xyz> writes:
> On Tue, Jul 08, 2025 at 09:00:39PM +0000, Tom Lane wrote:
>> Also fix a number of places where variables that are assigned to
>> within a PG_TRY and then used after it were not initialized or
>> not marked as volatile. (A few buildfarm members were issuing
>> "may be used uninitialized" warnings about some of these variables,
>> which is what drew my attention to this area.)

> Oops, thanks. I was not aware of these reports, and the buildfarm was
> not showing any red, the CI looked fine and my machine did not
> complain with a rather new gcc. What were the buildfarm members
> impacted? Did these use a switch and/or a specific compiler that
> helped in detecting these problems?

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.

regards, tom lane

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2025-07-09 18:21:16 pgsql: Link libpq with libdl if the platform needs that.
Previous Message Jeff Davis 2025-07-09 15:48:04 pgsql: Change wchar2char() and char2wchar() to accept a locale_t.