Re: --with-llvm on 32-bit platforms? - Mailing list pgsql-hackers

From Dmitry Mityugov
Subject Re: --with-llvm on 32-bit platforms?
Date
Msg-id 38d2ab2a3b6e3fa986beb2b1d397dcef@postgrespro.ru
Whole thread Raw
In response to Re: --with-llvm on 32-bit platforms?  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: --with-llvm on 32-bit platforms?
List pgsql-hackers
Tom Lane писал(а) 2025-09-15 22:16:
> Dmitry Mityugov <d.mityugov@postgrespro.ru> writes:
>> Peter Eisentraut wrote 2025-09-15 09:36:
>>> It seems plausible that this is related to commit 2a600a93c7b "Make
>>> type Datum be 8 bytes wide everywhere.".  I don't have any more
>>> insights than that.
> 
>> Thanks for the hint. I did git bisect, and [ Peter's right ]
> 
> Interesting.  You have at no point shown any details about what
> these failures look like.  However, I wonder if it could be
> something about broken alignment expectations.  The recent
> commit 09036dc71 fixed one thing that we'd managed not to notice
> in earlier testing, and I can't avoid the suspicion that there's
> more.

I did mention that `make check` fails if I enable --with-llvm flag on 
32-bit Linux platforms, for both GCC and Clang, at the very first 
message in this thread. Sorry if this got lost in quoting and 
formatting.

Thank you for pointing me to the commit, I'll check it.

What's interesting is that when I add the following (quick and dirty) 
assertion to DatumGetPointer on 32-bit Linux platforms,

DatumGetPointer(Datum X)
{
         Assert((X & 0xFFFFFFFF00000000) == 0);
         return (Pointer) (uintptr_t) X;
}

I get a failure in Postgres executable early on startup. If I am 
correct, this means that there are places in the code that assume that 
PointerGetDatum(DatumGetPointer(X)) == X, and this is not true if the 
pointer size is smaller than the Datum size. Hopefully I am not correct 
on this, but this might mean that the problem is broader than just 
enabling --with-llvm.

Thank you for your valuable time,



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #18959: Name collisions of expression indexes during parallel Index creations on a pratitioned table.
Next
From: Tom Lane
Date:
Subject: Re: --with-llvm on 32-bit platforms?