Re: [PATCH] intXshr, intXshl: return error on shift count out of range - Mailing list pgsql-hackers

From David Rowley
Subject Re: [PATCH] intXshr, intXshl: return error on shift count out of range
Date
Msg-id CAApHDvr0O6ZF8NO=Rq9Q+Sz=FHT=NZ1kkNTXZDcNph-OWuk7TQ@mail.gmail.com
Whole thread
In response to Re: [PATCH] intXshr, intXshl: return error on shift count out of range  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [PATCH] intXshr, intXshl: return error on shift count out of range
List pgsql-hackers
On Thu, 1 Oct 2026 at 08:25, Tom Lane <tgl@sss.pgh.pa.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



pgsql-hackers by date:

Previous
From: David Rowley
Date:
Subject: Re: [PATCH] intXshr, intXshl: return error on shift count out of range
Next
From: Tom Lane
Date:
Subject: Re: [PATCH] intXshr, intXshl: return error on shift count out of range