Re: Clang UndefinedBehaviorSanitize (Postgres14) Detected undefined-behavior

From: Peter Geoghegan <pg(at)bowt(dot)ie>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>, 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 19:38:51
Message-ID: CAH2-Wzn8oEs+1NgubAOZzbM4rNOYak87D6cOo6SN8EH1zYiWPQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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.

--
Peter Geoghegan

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2020-08-31 19:43:24 Re: Boundary value check in lazy_tid_reaped()
Previous Message Victor Spirin 2020-08-31 19:38:36 Re: Sometimes the output to the stdout in Windows disappears