summaryrefslogtreecommitdiffstats
path: root/ir_function_inlining.cpp
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2010-04-22 18:41:32 -0700
committerIan Romanick <[email protected]>2010-04-23 16:12:44 -0700
commit22147be898fd5a1737efd677244c2c5618644e7e (patch)
tree122defce9552f09beba891b68ba952cd453415b6 /ir_function_inlining.cpp
parent6aeada79662aa8a0c613158667dad66a6deb02a4 (diff)
ir_function_inlining: Avoid NULL dereference on assignment conditions.
Diffstat (limited to 'ir_function_inlining.cpp')
-rw-r--r--ir_function_inlining.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/ir_function_inlining.cpp b/ir_function_inlining.cpp
index c0e77b42730..025124ae2b2 100644
--- a/ir_function_inlining.cpp
+++ b/ir_function_inlining.cpp
@@ -214,7 +214,7 @@ ir_function_cloning_visitor::visit(ir_dereference *ir)
void
ir_function_cloning_visitor::visit(ir_assignment *ir)
{
- ir_rvalue *lhs, *rhs, *condition;
+ ir_rvalue *lhs, *rhs, *condition = NULL;
ir->lhs->accept(this);
lhs = this->result->as_rvalue();
@@ -222,8 +222,10 @@ ir_function_cloning_visitor::visit(ir_assignment *ir)
ir->rhs->accept(this);
rhs = this->result->as_rvalue();
- ir->condition->accept(this);
- condition = this->result->as_rvalue();
+ if (ir->condition) {
+ ir->condition->accept(this);
+ condition = this->result->as_rvalue();
+ }
this->result = new ir_assignment(lhs, rhs, condition);
}