Re: Not-terribly-safe checks for CRC intrinsic support

From: John Naylor <johncnaylorls(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Not-terribly-safe checks for CRC intrinsic support
Date: 2025-03-17 09:44:21
Message-ID: CANWCAZapfYkk+vqF+qeomOE7-0uFbPRJ=U=n3ghMxF_4-gAkCQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Mar 15, 2025 at 6:04 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> In short, I think we ought to apply and perhaps back-patch something
> like the attached.

Seems like reasonable defensive coding and consistency.

- /* return computed value, to prevent the above being optimized away */
+ /* else this function could get optimized away altogether: */

- /* return computed value, to prevent the above being optimized away */
+ /* return computed value, just to be extra sure this isn't
optimized away */

I'd be okay with keeping the original comment, though, since it seems
to be explaining the choice well enough.

> BTW, it looks to me like PGAC_AVX512_POPCNT_INTRINSICS is at similar
> hazard, but I'm not entirely sure how to fix that one.

"buf" is the variable there that we're loading from, so that would be
the one to make global.

--
John Naylor
Amazon Web Services

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Steven Niu 2025-03-17 09:48:06 Re: Forbid to DROP temp tables of other sessions
Previous Message Daniil Davydov 2025-03-17 09:03:55 Re: Forbid to DROP temp tables of other sessions