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

From: Erik Rijkers <er(at)xs4all(dot)nl>
To: Dmitry Mityugov <d(dot)mityugov(at)postgrespro(dot)ru>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: patch: Use pg_assume in jsonb_util.c to fix GCC 15 warnings
Date: 2025-07-11 10:20:36
Message-ID: c6beb002-9c0b-e062-85d6-8113610edb3e@xs4all.nl
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Op 7/10/25 om 22:00 schreef Dmitry Mityugov:
> 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.

Yes, compiles fine for me with gcc 15.1.0 (with and without
--enable-cassert). It's nice to finally get a silent compile again.

Thanks,

Erik

>
> I'm attaching the patch.
>
> Regards,
> Dmitry

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Konstantin Knizhnik 2025-07-11 10:27:26 Re: Logical replication prefetch
Previous Message Zhang Mingli 2025-07-11 10:13:06 [Question] Window Function Results without ORDER BY Clause