printtup.c: error: ‘VARSIZE_ANY’ makes pointer from integer when USE_VALGRIND is defined

From: Dmitry Mityugov <d(dot)mityugov(at)postgrespro(dot)ru>
To: pgsql-hackers(at)postgresql(dot)org
Subject: printtup.c: error: ‘VARSIZE_ANY’ makes pointer from integer when USE_VALGRIND is defined
Date: 2025-08-05 17:37:01
Message-ID: bf504e949151a5fb5723bca32b2033d1@postgrespro.ru
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

When USE_VALGRIND is defined, compilation started to fail with this
error message (-Werror is used; without it, a warning is observed
instead):

printtup.c:353:95: error: passing argument 1 of ‘VARSIZE_ANY’ makes
pointer from integer without a cast [-Wint-conversion]

Not sure if this is the best fix, but it silences the warning, and is
based on other recently introduced fixes:

diff --git a/src/backend/access/common/printtup.c
b/src/backend/access/common/printtup.c
index 830a3d883aa..6d3045e2332 100644
--- a/src/backend/access/common/printtup.c
+++ b/src/backend/access/common/printtup.c
@@ -350,7 +350,7 @@ printtup(TupleTableSlot *slot, DestReceiver *self)
*/
if (thisState->typisvarlena)
VALGRIND_CHECK_MEM_IS_DEFINED(DatumGetPointer(attr),
- VARSIZE_ANY(attr));
+
VARSIZE_ANY(DatumGetPointer(attr)));

if (thisState->format == 0)
{

I'm attaching a patch.

Best regards,
Dmitry

Attachment Content-Type Size
0001-Use-DatumGetPointer-in-VALGRIND_CHECK_MEM_IS_DEFINED.patch text/x-diff 875 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeff Davis 2025-08-05 17:40:22 Re: Proposal: "query_work_mem" GUC, to distribute working memory to the query's individual operators
Previous Message Masahiko Sawada 2025-08-05 17:33:47 Re: Convert varatt.h macros to static inline functions