Re: Clang UndefinedBehaviorSanitize (Postgres14) Detected undefined-behavior - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: Clang UndefinedBehaviorSanitize (Postgres14) Detected undefined-behavior
Date
Msg-id 20200831170050.GA3569@alvherre.pgsql
Whole thread Raw
In response to Re: Clang UndefinedBehaviorSanitize (Postgres14) Detected undefined-behavior  (Ranier Vilela <ranier.vf@gmail.com>)
Responses Re: Clang UndefinedBehaviorSanitize (Postgres14) Detected undefined-behavior
List pgsql-hackers
On 2020-Aug-31, Ranier Vilela wrote:

> More troubles with undefined-behavior.
> 
> This type of code can leaves overflow:
> var = (cast) (expression);
> diff = (int32) (id1 - id2);
> 
> See:
>     diff64 =  ((long int) d1 - (long int) d2);
>     diff64=-4294901760

Did you compile this with gcc -fwrapv?

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



pgsql-hackers by date:

Previous
From: Neha Sharma
Date:
Subject: Re: PATCH: logical_work_mem and logical streaming of large in-progress transactions
Next
From: Tom Lane
Date:
Subject: Re: Get rid of runtime handling of AlternativeSubPlan?