patch: Use pg_assume in jsonb_util.c to fix GCC 15 warnings

From: Dmitry Mityugov <d(dot)mityugov(at)postgrespro(dot)ru>
To: pgsql-hackers(at)postgresql(dot)org
Subject: patch: Use pg_assume in jsonb_util.c to fix GCC 15 warnings
Date: 2025-07-10 20:00:00
Message-ID: 0c623e8a204187b87b4736792398eaf1@postgrespro.ru
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

When compiled with Assert() macro disabled, GCC 15 produces warnings
about possibly uninitialized variables in
src/backend/utils/adt/jsonb_util.c module. This problem was discussed in
detail in this thread, in April 2025:
https://www.postgresql.org/message-id/988bf1bc-3f1f-99f3-bf98-222f1cd9dc5e@xs4all.nl
.

Recently introduced pg_assume() macro let fix such problems easily. The
attached patch fixes them in jsonb_util.c module. I verified that
PostgreSQL compiles clearly with this patch and GCC 15.1.1 on an x86
64-bit machine (with and without --enable-cassert), and with GCC 14.2.1
on a 64-bit ARM machine. `make check` also passes.

I'm attaching the patch.

Regards,
Dmitry

Attachment Content-Type Size
0001-Use-pg_assume-in-jsonb_util.c-to-fix-GCC-15-warning.patch text/x-diff 1.1 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Florents Tselai 2025-07-10 20:38:43 Re: encode/decode support for base64url
Previous Message Andres Freund 2025-07-10 19:29:33 Re: AIO v2.5