pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: exclusion@gmail.com
Subject: BUG #18200: Undefined behaviour in interval_div
Date: Wed, 15 Nov 2023 13:00:01 +0000
Message-ID: <18200-5ea288c7b2d504b1@postgresql.org> (raw)

The following bug has been logged on the website:

Bug reference:      18200
Logged by:          Alexander Lakhin
Email address:      exclusion@gmail.com
PostgreSQL version: 16.1
Operating system:   Ubuntu 22.04
Description:        

The following query:
SELECT interval '12000000 months' / 0.001;

triggers an ubsan-detected error:
timestamp.c:3408:18: runtime error: 1.2e+10 is outside the range of
representable values of type 'int'

Without ubsan the result is:
 -178956970 years -8 mons -2562047788:00:54.775808

This bogus value returned on REL_15_STABLE .. master, but on e39f99046~1
I get:
ERROR:  interval out of range

without ubsan. Though with the sanitizer I see the same complaint (and it
can be seen on previous branches including REL_12_STABLE):
timestamp.c:3318:18: runtime error: 1.2e+10 is outside the range of
representable values of type 'int'



view thread (5+ messages)  latest in thread

Message-ID: <18200-5ea288c7b2d504b1@postgresql.org>
Permalink:  ../18200-5ea288c7b2d504b1@postgresql.org/
Also on:    postgresql.org/message-id/18200-5ea288c7b2d504b1@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 using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, exclusion@gmail.com
  Subject: Re: BUG #18200: Undefined behaviour in interval_div
  In-Reply-To: <18200-5ea288c7b2d504b1@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