Re: BUG #16790: Integer overflow not detected with <<

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: exclusion(at)gmail(dot)com
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #16790: Integer overflow not detected with <<
Date: 2020-12-23 15:29:56
Message-ID: 710063.1608737396@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

PG Bug reporting form <noreply(at)postgresql(dot)org> writes:
> It seems that the bitwise shift left operator ignores overflow:
> Is this an expected behavior (a kind of UB)? It's not like an arithmetic
> shift. (The semantic of '1::int4<<-1' is questionable too.)

It's defined to do whatever the C << operator does. That will certainly
not involve throwing an error.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Alexander Lakhin 2020-12-23 17:50:00 Re: BUG #16790: Integer overflow not detected with <<
Previous Message PG Bug reporting form 2020-12-23 09:00:01 BUG #16790: Integer overflow not detected with <<