On Fri, 13 Nov 2026 at 16:13, Philippe Mathieu-Daudé
<[email protected]> wrote:
>
> Various individual fixes noted while reviewing manuals
> during decodetree conversion, and using a RISU prototype.

If you have a little time for MIPS could I get you to have a look at
Coverity issue 1689817 ? It's not urgent, but Coverity complains about
what it thinks is some dead code in the dextr_s_h helper:

    } else if ((temp127 == 1) &&
            (temp[1] < 0xFFFFFFFFFFFFFFFFll
             || temp[0] < 0xFFFFFFFFFFFF1000ll)) {

The compare with temp[1] is very odd here. The constant has the "ll"
suffix indicating that the author thought this would be signed,
but the value is 0xFFFF_FFFF_FFFF_FFFF so it doesn't fit in a
signed 64-bit integer type. So the C spec says it has type
"unsigned long long" (because it's a hex constant). That means
that the comparison is int64_t against uint64_t, which causes
temp[1] to be cast to unsigned and we do an unsigned comparison.

The upshot is that "temp[1] < 0xFFFFFFFFFFFFFFFFll" is a funny way of
writing "temp[1] != -1". So I think Coverity is wrong about there
being dead code, but it's confused because the code is written in a
confusing and possibly wrong way.

The comparison with temp[] is also 0xFFFF_FFFF_FFFF_1000 with the
LL suffix, so it's also not really a signed value or comparison.

I don't know what this instruction is supposed to be doing, but
it would be helpful if somebody who does could have a look and
rewrite the code to either do the right thing if the current
code is wrong, or else to rephrase it so it is clearer about
what it's doing if it's getting the right result in a weird way.

thanks
-- PMM

Reply via email to