summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2010-04-29 13:54:19 -0700
committerEric Anholt <eric@anholt.net>2010-04-29 13:54:19 -0700
commit438f38c55afc8a31d01af357de95a56044ea7055 (patch)
treea96fb0523f5c5ed6141ee26f24467a2d33405ee3
parenta2c6df556655e3619f5a0cd82b0d11aac37c5692 (diff)
ir_dead_code: Fix segfault on handling a return statement with no value.
-rw-r--r--ir_dead_code.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/ir_dead_code.cpp b/ir_dead_code.cpp
index 81fbeba..a73e9ed 100644
--- a/ir_dead_code.cpp
+++ b/ir_dead_code.cpp
@@ -251,7 +251,10 @@ ir_dead_code_visitor::visit(ir_call *ir)
void
ir_dead_code_visitor::visit(ir_return *ir)
{
- ir->get_value()->accept(this);
+ ir_rvalue *val = ir->get_value();
+
+ if (val)
+ val->accept(this);
}