Commit 9ff48ac3 by Ian Lance Taylor

Don't crash when returning something from a function named '_'.

From-SVN: r168143
parent 91ab2208
...@@ -659,7 +659,13 @@ Gogo::start_function(const std::string& name, Function_type* type, ...@@ -659,7 +659,13 @@ Gogo::start_function(const std::string& name, Function_type* type,
Named_object* ret; Named_object* ret;
if (Gogo::is_sink_name(*pname)) if (Gogo::is_sink_name(*pname))
ret = Named_object::make_sink(); {
static int sink_count;
char buf[30];
snprintf(buf, sizeof buf, ".$sink%d", sink_count);
++sink_count;
ret = Named_object::make_function(buf, NULL, function);
}
else if (!type->is_method()) else if (!type->is_method())
{ {
ret = this->package_->bindings()->add_function(*pname, NULL, function); ret = this->package_->bindings()->add_function(*pname, NULL, function);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment