[Mesa-dev] [PATCH 2/5] nir/cf: Fix unlink_block_successors to actually unlink the second one.

Connor Abbott cwabbott0 at gmail.com
Fri Sep 4 09:07:16 PDT 2015


On Thu, Sep 3, 2015 at 2:32 PM, Kenneth Graunke <kenneth at whitecape.org> wrote:
> Calling unlink_blocks(block, block->successors[0]) will successfully
> unlink the first successor, but then will shift block->successors[1]
> down to block->successor[0].  So the successors[1] != NULL check will
> always fail.
>
> Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
> ---
>  src/glsl/nir/nir_control_flow.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/glsl/nir/nir_control_flow.c b/src/glsl/nir/nir_control_flow.c
> index d0b2a10..b820abc 100644
> --- a/src/glsl/nir/nir_control_flow.c
> +++ b/src/glsl/nir/nir_control_flow.c
> @@ -93,10 +93,10 @@ unlink_blocks(nir_block *pred, nir_block *succ)
>  static void
>  unlink_block_successors(nir_block *block)
>  {
> -   if (block->successors[0] != NULL)
> -      unlink_blocks(block, block->successors[0]);
>     if (block->successors[1] != NULL)
>        unlink_blocks(block, block->successors[1]);
> +   if (block->successors[0] != NULL)
> +      unlink_blocks(block, block->successors[0]);
>  }
>
>  static void
> --
> 2.5.0
>

Patches 2-5 are

Reviewed-by: Connor Abbott <cwabbott0 at gmail.com>

but either I'm not not understanding the problem patch 1 is trying to
solve, or there's something worse going on.


More information about the mesa-dev mailing list