Re: BUG #7588: pgsql 9.1 incompatible with zlib 1.27 - Mailing list pgsql-bugs

From John Marino
Subject Re: BUG #7588: pgsql 9.1 incompatible with zlib 1.27
Date
Msg-id 5071E0C8.40205@marino.st
Whole thread Raw
In response to Re: BUG #7588: pgsql 9.1 incompatible with zlib 1.27  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
On 10/7/2012 21:54, Tom Lane wrote:
> John Marino<draco@marino.st>  writes:
>> Perhaps, you need to take a closer look at this. I guarantee that I
>> didn't do this for cosmetic reasons.  GCC behavior changed with GCC 4.5
>> on this topic.
>
> You should report it as a bug in whatever distro you're using, because
> the behavior did *not* change anywhere else, and the code you say your
> compiler is rejecting is clearly legal per C standard.  sizeof() is
> a compile-time constant.
>
>             regards, tom lane

Tom, it's a stock gcc47.
It's not "sizeof" that is causing the problem.

One cause is bufpage.h,
#define SizeOfPageHeaderData (offsetof(PageHeaderData, pd_linp))

Offsetof is the offender.

Two more on htup.h:
#define MINIMAL_TUPLE_PADDING \
      ((offsetof(HeapTupleHeaderData, t_infomask2) - sizeof(uint32)) %
MAXIMUM_ALIGNOF)
#define MaxHeapTuplesPerPage    \
    ((int) ((BLCKSZ - SizeOfPageHeaderData) / \
            (MAXALIGN(offsetof(HeapTupleHeaderData, t_bits)) + sizeof(ItemIdData))))

Again, offsetof is the offender in both cases.

Are you 100% sure that offsetof is evaluated at compile time?  Is this
not part of section 6.6 that I quoted earlier?

John

pgsql-bugs by date:

Previous
From: Franco Ricci
Date:
Subject: Re: BUG #7586: PL/Perl problem
Next
From: Robert Haas
Date:
Subject: Re: BUG #7534: walreceiver takes long time to detect n/w breakdown