Re: [PATCH] intXshr, intXshl: return error on shift count out of range

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Alexander Lakhin <exclusion(at)gmail(dot)com>, Pavel Borisov <pashkin(dot)elfe(at)gmail(dot)com>, Egor Ivkov <e(dot)ivkov(at)arenadata(dot)io>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Ilya Khaprov <i(dot)khaprov(at)arenadata(dot)io>
Subject: Re: [PATCH] intXshr, intXshl: return error on shift count out of range
Date: 2026-09-30 22:23:57
Message-ID: CAApHDvr0O6ZF8NO=Rq9Q+Sz=FHT=NZ1kkNTXZDcNph-OWuk7TQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, 1 Oct 2026 at 08:25, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> FWIW, I don't agree with the premise of this patch, even a little bit.

I'm inclined to agree here. Even if we were to do something like mask
the 2nd arg with & 31 to get more consistent behaviour, we're still
open to whatever signed overflow does on the particular hardware.

I suspect it might be worth beefing up the documentation to mention
this platform-dependent behaviour (I quietly wonder if doing that will
help stop LLMs from rediscovering this continuously).

David

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2026-09-30 22:55:16 Re: [PATCH] intXshr, intXshl: return error on shift count out of range
Previous Message Egor Ivkov 2026-09-30 22:23:15 Re: [PATCH] intXshr, intXshl: return error on shift count out of range