Another issue/thread is [1] that could be simpler with back-patched int128.

> FWIW, I just asked Claude Sonnet to review it, and it reported no active bugs.

Fable pointed out that there's one UB in non-native int128_div_mod_int32
src/include/common/int128.h:350: d = abs(v); is UB for v = INT32_MIN.
Comment above explicitly allows |v| = 2^31.
gcc -m32 -O2/-O3/-Os without -fwrapv returns wrong quotients: 2^64 /
INT32_MIN gives 0, should be -2^33.

As postgres currently uses fwrapv this seems like a nit and definitely
not a reason against back-patching, but there were already multiple
commits in the past removing fwrapv dependence, so I thought it is
worth at least a mention.

[1]: 
https://www.postgresql.org/message-id/CAEPgAbE%2BV7Wgx-1BYap276v_Ohc7Zk2HV3-U8Wp520Jz84NRmg%40mail.gmail.com


Reply via email to