summaryrefslogtreecommitdiff
path: root/gcc/go
diff options
context:
space:
mode:
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2015-11-01 20:46:37 +0000
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2015-11-01 20:46:37 +0000
commit4389a9e7ff39f438255bf488c216e8b26b1a0f3a (patch)
treea2eae08a27cf1d0d125f8de5efd24ed1dec89e0a /gcc/go
parent02132d91cf8dc4725f485f5bbe6d3fb58c9c242f (diff)
downloadgcc-4389a9e7ff39f438255bf488c216e8b26b1a0f3a.tar.gz
PR go/67968
compiler: Traverse types of call expressions. https://gcc.gnu.org/PR67968 provides a test case that causes a gccgo crash on valid code. The compiler failed to build the hash and equality functions required for a type descriptor. The descriptor is for an unnamed type that is being returned by a function imported from a different package. The unnamed type is being implicitly converted to an interface type by a return statement. The fix is to ensure that the type of a call expression is always traversed. Test case sent out for the master testsuite as https://golang.org/cl/16532 . git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_9-branch@229644 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/go')
-rw-r--r--gcc/go/gofrontend/expressions.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc
index b0b8e39e96e..011f441f245 100644
--- a/gcc/go/gofrontend/expressions.cc
+++ b/gcc/go/gofrontend/expressions.cc
@@ -9136,6 +9136,16 @@ Builtin_call_expression::do_export(Export* exp) const
int
Call_expression::do_traverse(Traverse* traverse)
{
+ // If we are calling a function in a different package that returns
+ // an unnamed type, this may be the only chance we get to traverse
+ // that type. We don't traverse this->type_ because it may be a
+ // Call_multiple_result_type that will just lead back here.
+ if (this->type_ != NULL && !this->type_->is_error_type())
+ {
+ Function_type *fntype = this->get_function_type();
+ if (fntype != NULL && Type::traverse(fntype, traverse) == TRAVERSE_EXIT)
+ return TRAVERSE_EXIT;
+ }
if (Expression::traverse(&this->fn_, traverse) == TRAVERSE_EXIT)
return TRAVERSE_EXIT;
if (this->args_ != NULL)