From da5d08707bf07c76b6a1851f3a36bb7c1f8d4d4b Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 30 Mar 2016 12:00:02 -0700 Subject: [PATCH] i965: Fix invalid pointer read in dead_control_flow_eliminate(). There may not be a previous block. In this case, there's no real work to do, so just continue on to the next one. v2: Update for bblock->prev() API change. Signed-off-by: Kenneth Graunke Reviewed-by: Jason Ekstrand Reviewed-by: Matt Turner --- src/mesa/drivers/dri/i965/brw_dead_control_flow.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/mesa/drivers/dri/i965/brw_dead_control_flow.cpp b/src/mesa/drivers/dri/i965/brw_dead_control_flow.cpp index 2c1abaf255c..114dc6cb212 100644 --- a/src/mesa/drivers/dri/i965/brw_dead_control_flow.cpp +++ b/src/mesa/drivers/dri/i965/brw_dead_control_flow.cpp @@ -42,6 +42,10 @@ dead_control_flow_eliminate(backend_shader *s) foreach_block_safe (block, s->cfg) { bblock_t *prev_block = block->prev(); + + if (!prev_block) + continue; + backend_instruction *const inst = block->start(); backend_instruction *const prev_inst = prev_block->end(); -- 2.30.2