Gccgo was crashing when a program called append with a single argument. Doing this doesn't make sense, but of course the compiler should not crash. The crash was due to the code passing nil as the second argument, then converting that to a slice composite literal. A slice composite literal needs a type, and this type was created too late for the type descriptor to be created. This patch finesses the issue by creating a slice value with a nil pointer instead. The test case for this is https://go-review.googlesource.com/#/c/1692/ . Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu. Committed to mainline.
Ian
diff -r b7c3f882d939 go/expressions.cc --- a/go/expressions.cc Tue Dec 16 14:50:50 2014 -0800 +++ b/go/expressions.cc Tue Dec 16 16:41:23 2014 -0800 @@ -6878,7 +6878,11 @@ ++pa) { if ((*pa)->is_nil_expression()) - *pa = Expression::make_slice_composite_literal(at, NULL, loc); + { + Expression* nil = Expression::make_nil(loc); + Expression* zero = Expression::make_integer_ul(0, NULL, loc); + *pa = Expression::make_slice_value(at, nil, zero, zero, loc); + } if (!(*pa)->is_variable()) { Temporary_statement* temp = @@ -14087,7 +14091,8 @@ int Slice_value_expression::do_traverse(Traverse* traverse) { - if (Expression::traverse(&this->valptr_, traverse) == TRAVERSE_EXIT + if (Type::traverse(this->type_, traverse) == TRAVERSE_EXIT + || Expression::traverse(&this->valptr_, traverse) == TRAVERSE_EXIT || Expression::traverse(&this->len_, traverse) == TRAVERSE_EXIT || Expression::traverse(&this->cap_, traverse) == TRAVERSE_EXIT) return TRAVERSE_EXIT;