Re: Keep compiler silence (clang 10, implicit conversion from 'long' to 'double' )
Yuya Watari <watari.yuya@gmail.com>
From: Yuya Watari <watari.yuya@gmail.com>
To: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Cc: pgsql-hackers@postgresql.org
Date: 2019-10-02T06:56:07Z
Lists: pgsql-hackers
Attachments
- test.c (text/plain)
- v3-keep-compiler-silence.patch (application/octet-stream) patch v3
Horiguchi-san, On Tue, Oct 1, 2019 at 3:41 PM Kyotaro Horiguchi <horikyota.ntt@gmail.com> wrote: > I found a trick seems workable generically (*1). (2.0 * > (PG_INT64_MAX/2 + 1)) will generate the value next to the > PG_INT64_MAX based on some assumptions > (*1). IS_DOUBLE_SAFE_IN_INT64() below would be able to check if > the value can be converted into int64 safely or not. Thanks for sharing a nice way of checking overflow. I tested your IS_DOUBLE_SAFE_IN_INT64() macro in my environment by the simple code (attached to this email) and confirmed that it appropriately handled the overflow. However, further consideration is needed for different architectures. I attached the modified patch. In the patch, I placed the macro in "src/include/c.h", but this may not be a good choice because c.h is widely included from a lot of files. Do you have any good ideas about its placement? Thanks, Yuya Watari NTT Software Innovation Center watari.yuya@gmail.com
Commits
-
Fix integer-overflow edge case detection in interval_mul and pgbench.
- 8d380864a523 9.4.25 landed
- 84780d468023 9.5.20 landed
- 15783d057543 9.6.16 landed
- 5f794f7572e1 10.11 landed
- b49b7f94489a 11.6 landed
- f6e72dc9cc8b 12.1 landed
- a7145f6bc8b7 13.0 landed
-
Change floating-point output format for improved performance.
- 02ddd499322a 12.0 cited