On Thu, 5 Nov 2026 16:16:57 +0000, Roderick wrote:
> CC marker.o > CC minibuf.o > CC fileio.o > /usr/opt/Emacs-31.1/emacs-31.1/src/fileio.c:3960:31: warning: implicit > conversion from 'off_t' (aka 'long long') to 'double' changes value > from > 9223372036854775807 to 9223372036854775808 > [-Wimplicit-const-int-float-conversion] > 3960 | if (0 <= v && v < 1.0 + TYPE_MAXIMUM (off_t)) > | ~ ^~~~~~~~~~~~~~~~~~~~ > [etc]
Thinking about these expressions, they are not just too clever for words, they are just plain wrong. Think about it: off_t is typically 64 bits nowadays. But double-precision reals only have about 53 bits of precision. So once a real gets beyond ±2**52, it will no longer be able to express a file offset accurately to the nearest byte. Where is there a file format that can tolerate misplacement of data that is off by a few bytes, or worse still, a few K? There isn’t one: you’ve got to be able to express byte offsets exactly, otherwise you will suffer data corruption. So the code should be fixed to not accept real values beyond the range that can exactly represent integers. To be safe, I think it should not be accepting real values for file offsets at all.