This patch to the Go frontend fixes it to not convert the function type in a call when calling an interface method. The function type of an interface method is not correct, since it does not include the receiver, but the type of the method field is correct, and as such should not be converted. This is PR 60870. Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu. Tested by Ulrich Weigand on PPC. Committed to mainline.
Ian
diff -r 43e2635914c2 go/expressions.cc --- a/go/expressions.cc Thu Apr 17 12:09:37 2014 -0700 +++ b/go/expressions.cc Thu Apr 17 12:24:08 2014 -0700 @@ -9619,9 +9619,20 @@ fn = Expression::make_compound(set_closure, fn, location); } - Btype* bft = fntype->get_backend_fntype(gogo); Bexpression* bfn = tree_to_expr(fn->get_tree(context)); - bfn = gogo->backend()->convert_expression(bft, bfn, location); + + // When not calling a named function directly, use a type conversion + // in case the type of the function is a recursive type which refers + // to itself. We don't do this for an interface method because 1) + // an interface method never refers to itself, so we always have a + // function type here; 2) we pass an extra first argument to an + // interface method, so fntype is not correct. + if (func == NULL && !is_interface_method) + { + Btype* bft = fntype->get_backend_fntype(gogo); + bfn = gogo->backend()->convert_expression(bft, bfn, location); + } + Bexpression* call = gogo->backend()->call_expression(bfn, fn_args, location); if (this->results_ != NULL)