Re: Detecting pointer misalignment (was Re: pgsql: Implementation of subscripting for jsonb)

From: Alexander Korotkov <aekorotkov(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, Alexander Korotkov <akorotkov(at)postgresql(dot)org>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Detecting pointer misalignment (was Re: pgsql: Implementation of subscripting for jsonb)
Date: 2021-02-09 00:35:01
Message-ID: CAPpHfdvmNwqEZajGsERi6y2Q7DRN892dPDt+WPTZqqsWDTFTZw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

On Mon, Feb 8, 2021 at 7:49 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Paquier 2021-02-09 05:17:57 pgsql: Add option PROCESS_TOAST to VACUUM
Previous Message Alexander Korotkov 2021-02-09 00:34:27 Re: Detecting pointer misalignment (was Re: pgsql: Implementation of subscripting for jsonb)

Browse pgsql-hackers by date

  From Date Subject
Next Message Tang, Haiying 2021-02-09 00:42:18 RE: Made ecpg compatibility mode and run-time behaviour options case insensitive
Previous Message Alexander Korotkov 2021-02-09 00:34:27 Re: Detecting pointer misalignment (was Re: pgsql: Implementation of subscripting for jsonb)