pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: exclusion@gmail.com
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #16790: Integer overflow not detected with <<
Date: Wed, 23 Dec 2020 10:29:56 -0500
Message-ID: <710063.1608737396@sss.pgh.pa.us> (raw)
In-Reply-To: <16790-c2a81c92a8776c5b@postgresql.org>
References: <16790-c2a81c92a8776c5b@postgresql.org>

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





view thread (3+ messages)  latest in thread

Message-ID: <710063.1608737396@sss.pgh.pa.us>
Permalink:  ../710063.1608737396@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/710063.1608737396@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, exclusion@gmail.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #16790: Integer overflow not detected with <<
  In-Reply-To: <710063.1608737396@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox