aboutsummaryrefslogtreecommitdiff
path: root/gcc/go
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2011-05-11 19:39:21 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2011-05-11 19:39:21 +0000
commit2d8f63a164c48a7e287987040927e40df7a97cab (patch)
tree31a227cd909da29937b261dd6535c837d3549a83 /gcc/go
parentcfca3f726741cbba6e6906afeac9ddc4c466fb3f (diff)
downloadgcc-2d8f63a164c48a7e287987040927e40df7a97cab.zip
gcc-2d8f63a164c48a7e287987040927e40df7a97cab.tar.gz
gcc-2d8f63a164c48a7e287987040927e40df7a97cab.tar.bz2
Don't crash ranging over call to builtin function.
From-SVN: r173671
Diffstat (limited to 'gcc/go')
-rw-r--r--gcc/go/gofrontend/expressions.cc10
-rw-r--r--gcc/go/gofrontend/statements.cc3
2 files changed, 7 insertions, 6 deletions
diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc
index 9338486..005173b 100644
--- a/gcc/go/gofrontend/expressions.cc
+++ b/gcc/go/gofrontend/expressions.cc
@@ -8527,9 +8527,9 @@ Call_expression::lower_varargs(Gogo* gogo, Named_object* function,
new_args->push_back(Expression::make_nil(loc));
// We can't return a new call expression here, because this one may
- // be referenced by Call_result expressions. FIXME.
- if (old_args != NULL)
- delete old_args;
+ // be referenced by Call_result expressions. FIXME. We can't
+ // delete OLD_ARGS because we may have both a Call_expression and a
+ // Builtin_call_expression which refer to them. FIXME.
this->args_ = new_args;
this->varargs_are_lowered_ = true;
@@ -9250,8 +9250,8 @@ Index_expression::do_lower(Gogo*, Named_object*, int)
error_at(location, "invalid slice of map");
return Expression::make_error(location);
}
- Map_index_expression* ret= Expression::make_map_index(left, start,
- location);
+ Map_index_expression* ret = Expression::make_map_index(left, start,
+ location);
if (this->is_lvalue_)
ret->set_is_lvalue();
return ret;
diff --git a/gcc/go/gofrontend/statements.cc b/gcc/go/gofrontend/statements.cc
index 4fdf8f1..4d335bb 100644
--- a/gcc/go/gofrontend/statements.cc
+++ b/gcc/go/gofrontend/statements.cc
@@ -4536,7 +4536,7 @@ For_range_statement::do_lower(Gogo* gogo, Named_object*, Block* enclosing)
else
{
this->report_error(_("range clause must have "
- "array, slice, setring, map, or channel type"));
+ "array, slice, string, map, or channel type"));
return Statement::make_error_statement(this->location());
}
@@ -4552,6 +4552,7 @@ For_range_statement::do_lower(Gogo* gogo, Named_object*, Block* enclosing)
{
range_temp = Statement::make_temporary(NULL, this->range_, loc);
temp_block->add_statement(range_temp);
+ this->range_ = NULL;
}
Temporary_statement* index_temp = Statement::make_temporary(index_type,