pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Silence some Coverity warnings and improve code consistency.
Date: Sun, 11 Apr 2021 21:02:13 +0000
Message-ID: <E1lVhDh-0000go-Kr@gemulon.postgresql.org> (raw)

Silence some Coverity warnings and improve code consistency.

Coverity complained about possible overflow in expressions like
        intresult = tm->tm_sec * 1000000 + fsec;
on the grounds that the multiplication would happen in 32-bit
arithmetic before widening to the int64 result.  I think these
are all false positives because of the limited possible range of
tm_sec; but nonetheless it seems silly to spell it like that when
nearby lines have the identical computation written with a 64-bit
constant.

... or more accurately, with an LL constant, which is not project
style.  Make all of these use INT64CONST(), as we do elsewhere.

This is all new code from a2da77cdb, so no need for back-patch.

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/6277435a8a89c59f716c111200c072d1454b8ff2

Modified Files
--------------
src/backend/utils/adt/date.c      | 14 +++++++-------
src/backend/utils/adt/timestamp.c | 26 +++++++++++++-------------
2 files changed, 20 insertions(+), 20 deletions(-)



view thread (3+ messages)  latest in thread

Message-ID: <E1lVhDh-0000go-Kr@gemulon.postgresql.org>
Permalink:  ../E1lVhDh-0000go-Kr@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1lVhDh-0000go-Kr@gemulon.postgresql.org

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Silence some Coverity warnings and improve code consistency.
  In-Reply-To: <E1lVhDh-0000go-Kr@gemulon.postgresql.org>
  References: <E1lVhDh-0000go-Kr@gemulon.postgresql.org>

* 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