diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2011-03-03 01:48:28 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2011-03-03 01:48:28 +0000 |
commit | 4bb9014024c51476b9466e50287c37f917cf0736 (patch) | |
tree | 6710c8705d93ebdefabfd9f4a8582b0ab26b1876 /gcc/go/gofrontend/parse.cc | |
parent | 86620d2d5fd57d0f7696dd74635f38248515c014 (diff) | |
download | gcc-4bb9014024c51476b9466e50287c37f917cf0736.zip gcc-4bb9014024c51476b9466e50287c37f917cf0736.tar.gz gcc-4bb9014024c51476b9466e50287c37f917cf0736.tar.bz2 |
Don't crash declaring a function named "_".
From-SVN: r170636
Diffstat (limited to 'gcc/go/gofrontend/parse.cc')
-rw-r--r-- | gcc/go/gofrontend/parse.cc | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/gcc/go/gofrontend/parse.cc b/gcc/go/gofrontend/parse.cc index ab6021d..7c03870 100644 --- a/gcc/go/gofrontend/parse.cc +++ b/gcc/go/gofrontend/parse.cc @@ -2063,9 +2063,12 @@ Parse::function_decl() return; } this->advance_token(); - named_object = this->gogo_->declare_function(name, fntype, location); - if (named_object->is_function_declaration()) - named_object->func_declaration_value()->set_asm_name(asm_name); + if (!Gogo::is_sink_name(name)) + { + named_object = this->gogo_->declare_function(name, fntype, location); + if (named_object->is_function_declaration()) + named_object->func_declaration_value()->set_asm_name(asm_name); + } } // Check for the easy error of a newline before the opening brace. @@ -2082,8 +2085,8 @@ Parse::function_decl() if (!this->peek_token()->is_op(OPERATOR_LCURLY)) { - if (named_object == NULL) - named_object = this->gogo_->declare_function(name, fntype, location); + if (named_object == NULL && !Gogo::is_sink_name(name)) + this->gogo_->declare_function(name, fntype, location); } else { |