mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 11:48:06 +02:00
freedreno/a3xx/compiler: overflow in trans_endif
The logic to count number of block outputs was out of sync with the actual array construction. But to simplify / make things less fragile, we can just allocate the arrays for worst case size. Signed-off-by: Rob Clark <robclark@freedesktop.org>
This commit is contained in:
parent
e0007f733d
commit
ecb71cfa66
1 changed files with 5 additions and 13 deletions
|
|
@ -1427,19 +1427,9 @@ trans_endif(const struct instr_translater *t,
|
|||
if (!elseb)
|
||||
elseb = ifb->parent;
|
||||
|
||||
/* count up number of outputs for each block: */
|
||||
for (i = 0; i < ifb->ntemporaries; i++) {
|
||||
if (ifb->temporaries[i])
|
||||
ifnout++;
|
||||
if (elseb->temporaries[i])
|
||||
elsenout++;
|
||||
}
|
||||
for (i = 0; i < ifb->noutputs; i++) {
|
||||
if (ifb->outputs[i])
|
||||
ifnout++;
|
||||
if (elseb->outputs[i])
|
||||
elsenout++;
|
||||
}
|
||||
/* worst case sizes: */
|
||||
ifnout = ifb->ntemporaries + ifb->noutputs;
|
||||
elsenout = elseb->ntemporaries + elseb->noutputs;
|
||||
|
||||
ifout = ir3_alloc(ctx->ir, sizeof(ifb->outputs[0]) * ifnout);
|
||||
if (elseb != ifb->parent)
|
||||
|
|
@ -1480,6 +1470,8 @@ trans_endif(const struct instr_translater *t,
|
|||
}
|
||||
}
|
||||
|
||||
compile_assert(ctx, ifb->noutputs == elseb->noutputs);
|
||||
|
||||
/* .. and any outputs written: */
|
||||
for (i = 0; i < ifb->noutputs; i++) {
|
||||
struct ir3_instruction *a = ifb->outputs[i];
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue