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

Started by Dmitry Mityugovabout 1 year ago2 messageshackers
Beta feature

Hackorum builds and tests every patch posted to the lists, not only commitfest submissions. This is Hackorum's own CI rather than the PostgreSQL project's, and it is still under testing - please report anything that looks wrong.

won't retrysuccessCI history

You can run a PostgreSQL built from this patch straight from Docker, with no checkout and no build:

docker run --rm -p 5432:5432 ghcr.io/hackorum-dev/postgres-patch:t52044
psql -h localhost -U postgres

Built from patchset v1 (message #1), July 27, 2026 at 08:13 AM.

Every patchset is also pushed to a branch of our PostgreSQL fork, so you can check out the same tree CI built. Without a PostgreSQL checkout:

git clone --branch t52044_1 https://github.com/hackorum-dev/postgres.git

In a checkout you already have, add the fork once:

git remote add hackorum https://github.com/hackorum-dev/postgres.git

then, for this patchset and every later one:

git fetch hackorum t52044_1 && git checkout t52044_1

Patchset v1 (message #1) is on t52044_1

Jump to latest
#1Dmitry Mityugov
d.mityugov@postgrespro.ru

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

Attachments:

t52044_1
0001-Use-DatumGetPointer-in-VALGRIND_CHECK_MEM_IS_DEFINED.patchtext/x-diff; name=0001-Use-DatumGetPointer-in-VALGRIND_CHECK_MEM_IS_DEFINED.patchDownload+1-2
#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Dmitry Mityugov (#1)
Re: printtup.c: error: ‘VARSIZE_ANY’ makes pointer from integer when USE_VALGRIND is defined

Dmitry Mityugov <d.mityugov@postgrespro.ru> writes:

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]

Thanks for the report, but I already fixed this a couple hours ago.

regards, tom lane