Re: Remove useless casting to the same type - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: Remove useless casting to the same type
Date
Msg-id 66057689-17e2-4f73-a1f0-6a9ef8f3af40@eisentraut.org
Whole thread Raw
In response to Re: Remove useless casting to the same type  (Bertrand Drouvot <bertranddrouvot.pg@gmail.com>)
Responses Re: Remove useless casting to the same type
List pgsql-hackers
On 25.11.25 06:46, Bertrand Drouvot wrote:
>> Maybe we should make the code compile cleanly under
>> -Wformat-signedness at some point...
> good idea, will give it a try later on outside the context of this patch.

I test this once in a while and fix the issues that I find.  But it's 
very picky and you will find difficult to fix problems like the fact 
that the signedness of enums is implementation-defined, and so the only 
portable fix there would be to add more casts.

I think it could be useful to tighten the source code with respect to 
implicit integer conversions, using warnings such as -Wsign-conversion 
and -Wconversion as well as -Wformat-signedness.  There are surely 
hidden overflow or truncation issues similar to CVE-2025-12818 hidden 
somewhere.  But explicit casts defeat those warnings, so removing 
unnecessary casts is a good step on the way there.




pgsql-hackers by date:

Previous
From: Chao Li
Date:
Subject: Migrate to autoconf 2.72?
Next
From: jian he
Date:
Subject: Re: ON CONFLICT DO SELECT (take 3)