[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: fossil build failure on riscv64



As a final update...

I've patched fossil src/th.c to use snprintf instead of the explicit
conversion loop.

Since writing -s with int s in any context, including unsigned u=-s,
when s is the most negative value, is undefined behaviour ... there is
no efficient way to write unsigned u=abs(s) and get what you want.
This impacts crypto code, where that is something you want to be able
to do efficiently and reliably.

So I've gotten in touch with someone reviewing the draft of the next C
standard, and they're going to try to get

extern unsigned uabs(int);

(and variants for other lengths) added to the standard C library.
Apparently this omission has been previously noted.


Reply to: