On Tuesday, May 27, 2014 06:47:36 PM Matt Turner wrote:
[snip]
> diff --git a/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp 
b/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp
> index 069b60f..a1aff21 100644
> --- a/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp
> @@ -353,7 +353,7 @@ fs_visitor::try_constant_propagate(fs_inst *inst, 
acp_entry *entry)
>     if (entry->src.file != IMM)
>        return false;
>  
> -   for (int i = 2; i >= 0; i--) {
> +   for (int i = inst->sources - 1; i >= 0; i--) {
>        if (inst->src[i].file != entry->dst.file ||
>            inst->src[i].reg != entry->dst.reg ||
>            inst->src[i].reg_offset != entry->dst.reg_offset ||

I am glad to see that you're using a signed integer type here.  For 
BRW_OPCODE_NOP, SHADER_OPCODE_PLACEHOLDER_HALT, and so on, inst->sources could 
conceievably be 0.  (Today, you set it to 3 for some reason, but I could see 
someone coming along and "fixing" that later...)

If you had used unsigned types, this would translate into i = 4294967296; i >= 
0; i--, which would take forever.  With signed types, it works, and no one 
should get bitten by that bug.

Patches 1-8 are:
Reviewed-by: Kenneth Graunke <kenn...@whitecape.org>
(and you can ignore my comment on patch 4 - I'm happy to see that done in 
later patches - no need to block this any further on trivialities)

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to