Re: Clang UndefinedBehaviorSanitize (Postgres14) Detected undefined-behavior

From: Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>
To: Peter Geoghegan <pg(at)bowt(dot)ie>
Cc: Andres Freund <andres(at)anarazel(dot)de>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Noah Misch <noah(at)leadboat(dot)com>
Subject: Re: Clang UndefinedBehaviorSanitize (Postgres14) Detected undefined-behavior
Date: 2020-08-31 20:28:58
Message-ID: CAEudQAqaknWkiW0VP4v1SgyD5qLybXXtTwbz7HuFjjTjz0XSOg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Em seg., 31 de ago. de 2020 às 16:39, Peter Geoghegan <pg(at)bowt(dot)ie> escreveu:

> On Mon, Aug 31, 2020 at 11:42 AM Andres Freund <andres(at)anarazel(dot)de> wrote:
> > Unsigned integer overflow is well defined in the standard. So I don't
> understand what this is purporting to warn about.
>
> Presumably it's simply warning that the value -4294901760 (i.e. the
> result of 3 - 4294901763) cannot be faithfully represented as an
> unsigned int. This is true, of course. It's just not relevant.
>
> I'm pretty sure that UBSan does not actually state that this is
> undefined behavior. At least Ranier's sample output didn't seem to
> indicate it.
>
4294901763 can not store at unsigned int (TransactionID is uint32_t).
TransactionId id2 at TransactionIdPrecedes already has an overflow, before
anything is done.

Ranier Vilela

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Ranier Vilela 2020-08-31 20:35:14 Re: Clang UndefinedBehaviorSanitize (Postgres14) Detected undefined-behavior
Previous Message Andres Freund 2020-08-31 20:05:21 Re: Clang UndefinedBehaviorSanitize (Postgres14) Detected undefined-behavior