i965/cfg: Assert that cur_do/while/if pointers are non-NULL.
authorMatt Turner <mattst88@gmail.com>
Mon, 22 Jun 2015 18:09:49 +0000 (11:09 -0700)
committerMatt Turner <mattst88@gmail.com>
Tue, 23 Jun 2015 19:24:42 +0000 (12:24 -0700)
Coverity sees that the functions immediately below the new assertions
dereference these pointers, but is unaware that an ENDIF always follows
an IF, etc.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
src/mesa/drivers/dri/i965/brw_cfg.cpp

index 39c419b9b96edd79a54ad62015e1cb2a1747855b..f1f230e3751b5b73f9f34baa831b75791e769921 100644 (file)
@@ -231,6 +231,7 @@ cfg_t::cfg_t(exec_list *instructions)
          if (cur_else) {
             cur_else->add_successor(mem_ctx, cur_endif);
          } else {
+            assert(cur_if != NULL);
             cur_if->add_successor(mem_ctx, cur_endif);
          }
 
@@ -299,6 +300,7 @@ cfg_t::cfg_t(exec_list *instructions)
          inst->exec_node::remove();
          cur->instructions.push_tail(inst);
 
+         assert(cur_do != NULL && cur_while != NULL);
         cur->add_successor(mem_ctx, cur_do);
         set_next_block(&cur, cur_while, ip);