From: ian Date: Mon, 15 Jun 2015 17:43:02 +0000 (+0000) Subject: compiler: Don't crash when dumping ast of empty block. X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f39b15c6763ca9e7165f53ad9e1ffd45c1e10c3f;p=thirdparty%2Fgcc.git compiler: Don't crash when dumping ast of empty block. Fixes golang/go#10420. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@224487 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/go/gofrontend/ast-dump.cc b/gcc/go/gofrontend/ast-dump.cc index 850e31a81e53..72b01420aa31 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 +}