Re: BUG #16790: Integer overflow not detected with << - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #16790: Integer overflow not detected with <<
Date
Msg-id 710063.1608737396@sss.pgh.pa.us
Whole thread Raw
In response to BUG #16790: Integer overflow not detected with <<  (PG Bug reporting form <noreply@postgresql.org>)
Responses Re: BUG #16790: Integer overflow not detected with <<
List pgsql-bugs
PG Bug reporting form <noreply@postgresql.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



pgsql-bugs by date:

Previous
From: PG Bug reporting form
Date:
Subject: BUG #16790: Integer overflow not detected with <<
Next
From: Alexander Lakhin
Date:
Subject: Re: BUG #16790: Integer overflow not detected with <<