Source-Changes archive

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

CVS commit: src/lib/libc/softfloat/bits64



Module Name:    src
Committed By:   rillig
Date:           Sat Apr  4 17:37:13 UTC 2026

Modified Files:
        src/lib/libc/softfloat/bits64: softfloat.c

Log Message:
libc: fix undefined behavior in int64_to_float128

When negating a signed integer, the integer must not be LLONG_MIN, as
negating that value would not change the sign. GCC's -ftrapv mode
detects cases like this reliably.

In this case, on sparc64 with -O2 (but not -O0 or -O1),
countLeadingZeros64(LLONG_MIN) returned 48 instead of the desired 0, and
int64_to_float128(LLONG_MIN) returned -0x1p+14 instead of the desired
-0x1p+63.

The same pattern is used in several other conversion functions. These
will be fixed in a follow-up commit once the lint tests for msg_380 and
msg_381 on sparc64 work again.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/lib/libc/softfloat/bits64/softfloat.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.




Home | Main Index | Thread Index | Old Index