diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2015-06-15 17:43:02 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2015-06-15 17:43:02 +0000 |
commit | b18fdafbc923da21b92fc1889cc932e4a26f4eb7 (patch) | |
tree | a843342acb48583f8bf04074f87a7f9eb7d85d8f | |
parent | 8e6dce3de77bcb858920d02e0f4e00159658d555 (diff) | |
download | gcc-b18fdafbc923da21b92fc1889cc932e4a26f4eb7.zip gcc-b18fdafbc923da21b92fc1889cc932e4a26f4eb7.tar.gz gcc-b18fdafbc923da21b92fc1889cc932e4a26f4eb7.tar.bz2 |
compiler: Don't crash when dumping ast of empty block.
Fixes golang/go#10420.
From-SVN: r224487
-rw-r--r-- | gcc/go/gofrontend/ast-dump.cc | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/gcc/go/gofrontend/ast-dump.cc b/gcc/go/gofrontend/ast-dump.cc index 850e31a..72b0142 100644 --- a/gcc/go/gofrontend/ast-dump.cc +++ b/gcc/go/gofrontend/ast-dump.cc @@ -65,6 +65,12 @@ class Ast_dump_traverse_statements : public Traverse int Ast_dump_traverse_blocks_and_functions::block(Block * block) { + if (block == NULL) + { + this->ast_dump_context_->ostream() << std::endl; + return TRAVERSE_EXIT; + } + this->ast_dump_context_->print_indent(); this->ast_dump_context_->ostream() << "{" << std::endl; this->ast_dump_context_->indent(); @@ -466,4 +472,4 @@ Ast_dump_context::dump_to_stream(const Expression* expr, std::ostream* out) { Ast_dump_context adc(out, false); expr->dump_expression(&adc); -}
\ No newline at end of file +} |