This Go frontend patch from Rémy Oudompheng avoids an ICE on an invalid
call to the builtin len function. Bootstrapped on
x86_64-unknown-linux-gnu. Committed to mainline and 4.7 branch.
Ian
diff -r 5b52b07a8cf4 go/expressions.cc
--- a/go/expressions.cc Wed Mar 28 15:24:30 2012 -0700
+++ b/go/expressions.cc Wed Mar 28 15:29:03 2012 -0700
@@ -6609,7 +6609,7 @@
if (this->code_ == BUILTIN_LEN || this->code_ == BUILTIN_CAP)
{
Expression* arg = this->one_arg();
- if (!arg->is_constant())
+ if (arg != NULL && !arg->is_constant())
{
Find_call_expression find_call;
Expression::traverse(&arg, &find_call);
@@ -6929,7 +6929,7 @@
Builtin_call_expression::one_arg() const
{
const Expression_list* args = this->args();
- if (args->size() != 1)
+ if (args == NULL || args->size() != 1)
return NULL;
return args->front();
}