Re: Detecting pointer misalignment (was Re: pgsql: Implementation of subscripting for jsonb) - Mailing list pgsql-hackers

From Alexander Korotkov
Subject Re: Detecting pointer misalignment (was Re: pgsql: Implementation of subscripting for jsonb)
Date
Msg-id CAPpHfdvmNwqEZajGsERi6y2Q7DRN892dPDt+WPTZqqsWDTFTZw@mail.gmail.com
Whole thread Raw
In response to Re: Detecting pointer misalignment (was Re: pgsql: Implementation of subscripting for jsonb)  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Detecting pointer misalignment (was Re: pgsql: Implementation of subscripting for jsonb)
List pgsql-hackers
On Mon, Feb 8, 2021 at 7:49 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> I wrote:
> > After digging in gcc's release history, it seems they invented
> > "-fsanitize=alignment" in GCC 5, so we can make this work for gcc
> > by writing
> > #if __GNUC__ >= 5
> > (the likely() macro already uses a similar approach).  Can't say
> > if that's close enough for clang too.
>
> Ugh, no it isn't: even pretty recent clang releases only define
> __GNUC__ as 4.  It looks like we need a separate test on clang's
> version.  I looked at their version history and sanitizers seem
> to have come in around clang 7, so I propose the attached (where
> I worked a bit harder on the comment, too).

Looks good to me.  Thank you for revising!

------
Regards,
Alexander Korotkov



pgsql-hackers by date:

Previous
From: Alexander Korotkov
Date:
Subject: Re: Detecting pointer misalignment (was Re: pgsql: Implementation of subscripting for jsonb)
Next
From: "Tang, Haiying"
Date:
Subject: RE: Made ecpg compatibility mode and run-time behaviour options case insensitive