Re: Convert varatt.h macros to static inline functions

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
Cc: Peter Eisentraut <peter(at)eisentraut(dot)org>, Michael Paquier <michael(at)paquier(dot)xyz>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Convert varatt.h macros to static inline functions
Date: 2025-08-05 18:34:44
Message-ID: 1130716.1754418884@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com> writes:
> I got the following compiler warning:

> % make -C src/backend/storage/large_object
> inv_api.c: In function ‘inv_write’:
> inv_api.c:565:29: warning: ‘workbuf’ may be used uninitialized
> [-Wmaybe-uninitialized]
> 565 | char *workb = VARDATA(&workbuf.hdr);
> | ^~~~~~~~~~~~~~~~~~~~~

> I've not fully investigated the root cause but commit e035863c9a0
> presumably is the culprit. FYI I'm using gcc 14.2.1.

Interesting. I did not see such warnings with gcc 14.3.1, 15.1.1,
nor older gcc versions. Must be something peculiar to 14.2.

> The attached patch fixes the warning.

Theoretically this shouldn't be necessary, since VARDATA()
does not touch the contents of the pointed-to object.
Still, no objection.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jacob Champion 2025-08-05 18:54:35 Re: [PoC] Federated Authn/z with OAUTHBEARER
Previous Message Tom Lane 2025-08-05 18:17:16 Re: printtup.c: error: ‘VARSIZE_ANY’ makes pointer from integer when USE_VALGRIND is defined