Skip to contentSkip to conversation

nv50: Fix broken assertion

PATCH In review Daniel Stone 4 participants 4 messages Feb 7, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nv50: Fix broken assertion

The assertion added in f09910f3 broke nv50 completely by asserting that the number of elements in a dereferenced pointer (i.e. 1) was greater than i (which ranged up to six), rather than checking the number of elements in the containing array.

---
 src/gallium/drivers/nv50/nv50_pc_regalloc.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
src/gallium/drivers/nv50/nv50_pc_regalloc.c +1 -1
index 72922cb..12a59cb 100644
@@ -421,7 +421,7 @@ phi_opnd_for_bb(struct nv_instruction *phi, struct nv_basic_block *b,
    int i, j;
 
    for (j = -1, i = 0; i < 6 && phi->src[i]; ++i) {
-      assert(i < Elements(phi->src[i]));
+      assert(i < Elements(phi->src));
       srci = phi->src[i];
       /* if already replaced, check with original source first */
       if (srci->flags & NV_REF_FLAG_REGALLOC_PRIV)
Signature · 1 line
1.7.9
#1 lore raw

Makes sense.

Jose

----- Original Message -----

Quoted 34 lines

The assertion added in f09910f3 broke nv50 completely by asserting that
the number of elements in a dereferenced pointer (i.e. 1) was greater than i (which ranged up to six), rather than checking the number of elements in the containing array.

---
 src/gallium/drivers/nv50/nv50_pc_regalloc.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
src/gallium/drivers/nv50/nv50_pc_regalloc.c +1 -1
index 72922cb..12a59cb 100644
@@ -421,7 +421,7 @@ phi_opnd_for_bb(struct nv_instruction *phi,
 struct nv_basic_block *b,
    int i, j;
 
    for (j = -1, i = 0; i < 6 && phi->src[i]; ++i) {
-      assert(i < Elements(phi->src[i]));
+      assert(i < Elements(phi->src));
       srci = phi->src[i];
       /* if already replaced, check with original source first */
       if (srci->flags & NV_REF_FLAG_REGALLOC_PRIV)

--
1.7.9

_______________________________________________
mesa-dev mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

#2 lore raw
Quoted 1 line · Jose Fonseca

Makes sense.

Very much so ...
http://cgit.freedesktop.org/mesa/mesa/commit/?id=189e6c7e81ce35b89d9b52d4bd0d6271a7e9c10f
(of 26 hours ago).

Quoted 42 lines

Jose

----- Original Message -----

Quoted 26 lines

The assertion added in f09910f3 broke nv50 completely by asserting that
the number of elements in a dereferenced pointer (i.e. 1) was greater than i (which ranged up to six), rather than checking the number of elements in the containing array.

---
 src/gallium/drivers/nv50/nv50_pc_regalloc.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
src/gallium/drivers/nv50/nv50_pc_regalloc.c +1 -1
index 72922cb..12a59cb 100644
@@ -421,7 +421,7 @@ phi_opnd_for_bb(struct nv_instruction *phi,
 struct nv_basic_block *b,
    int i, j;
 
    for (j = -1, i = 0; i < 6 && phi->src[i]; ++i) {
-      assert(i < Elements(phi->src[i]));
+      assert(i < Elements(phi->src));
       srci = phi->src[i];
       /* if already replaced, check with original source first */
       if (srci->flags & NV_REF_FLAG_REGALLOC_PRIV)
Quoted 8 lines

--
1.7.9

_______________________________________________
mesa-dev mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

_______________________________________________
mesa-dev mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-dev