pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix up misuse of "volatile" in contrib/xml2.
Date: Tue, 08 Jul 2025 21:00:39 +0000
Message-ID: <E1uZFQd-005Je7-1t@gemulon.postgresql.org> (raw)

Fix up misuse of "volatile" in contrib/xml2.

What we want in these places is "xmlChar *volatile ptr",
not "volatile xmlChar *ptr".  The former means that the
pointer variable itself needs to be treated as volatile,
while the latter says that what it points to is volatile.
Since the point here is to ensure that the pointer variables
don't go crazy after a longjmp, it's the former semantics
that we need.  The misplacement of "volatile" also led
to needing to cast away volatile in some places.

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.)  In most cases
these variables were being set as the last step within the PG_TRY
block, which might mean that we could get away without the "volatile"
marking.  But doing that seems unsafe and is definitely not per our
coding conventions.

These problems seem to have come in with 732061150, so no need
for back-patch.

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/93001888d85c21a5b9ab1fe8dabfecb673fc007c

Modified Files
--------------
contrib/xml2/xpath.c     | 49 ++++++++++++++++++++++++------------------------
contrib/xml2/xslt_proc.c | 10 +++++-----
2 files changed, 29 insertions(+), 30 deletions(-)



view thread (6+ messages)  latest in thread

Message-ID: <E1uZFQd-005Je7-1t@gemulon.postgresql.org>
Permalink:  ../E1uZFQd-005Je7-1t@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1uZFQd-005Je7-1t@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Fix up misuse of "volatile" in contrib/xml2.
  In-Reply-To: <E1uZFQd-005Je7-1t@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox