[Mesa-dev] Signed/unsigned bug in r300 compiler

Matt Turner mattst88 at gmail.com
Wed Sep 5 00:20:11 PDT 2012


Hi Tom,

In playing with Coccinelle, I discovered a signed/unsigned bug in
radeon_rename_regs.c:rc_rename_regs.

unsigned new_index;
unsigned writemask;
struct rc_variable * var = var_ptr->Item;

if (var->Inst->U.I.DstReg.File != RC_FILE_TEMPORARY) {
        continue;
}

new_index = rc_find_free_temporary_list(c, used, used_length,
                                                RC_MASK_XYZW);
if (new_index < 0) {
        rc_error(c, "Ran out of temporary registers\n");
        return;
}

unsigned new_index is compared with < 0.

I don't know the code, but I can't imagine that you'd need an unsigned
to represent a register index value.

Matt


More information about the mesa-dev mailing list