tech-toolchain archive

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

gcc unsigned vs signed compare

I tracked down a bug on a mips64el platform (see PR 45310), which turns out
to be a signed vs unsigned compare issue.

In lib/libc/gen/fixunsgen_ieee754.c there is a compare:
        (exp - mant_dig > sizeof(UINTXX_T)*8-1)
exp is int, mant_dig is size_t (unsigned long) and sizeof returns size_t.
gcc generates an unsigned compare for this, which doesn't gives the expected
result when exp < mant_dig. Is gcc right when generating an unsigned
compare here ?

Manuel Bouyer <>
     NetBSD: 26 ans d'experience feront toujours la difference

Home | Main Index | Thread Index | Old Index