diff options
author | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-11-01 20:46:04 +0000 |
---|---|---|
committer | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-11-01 20:46:04 +0000 |
commit | 0c0dacab8c055c99185a216f6c8969e91f1b37f8 (patch) | |
tree | 54acec5a01c9df5afe8a59e27d41dcf20bdccfcd /gcc/go | |
parent | d731e7b6e0cce6f2d706af2be890222f21f4eac6 (diff) | |
download | gcc-0c0dacab8c055c99185a216f6c8969e91f1b37f8.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/trunk@229642 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/go')
-rw-r--r-- | gcc/go/gofrontend/MERGE | 2 | ||||
-rw-r--r-- | gcc/go/gofrontend/expressions.cc | 10 |
2 files changed, 11 insertions, 1 deletions
diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index d2c9492b54d..e30927f6998 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -1c1f226662a6c84eae83f8aaec3d4503e70be843 +65ff1d5fb581717229e5c02796d719671a1e8628 The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc index c9750bd0aee..9037f0f2f80 100644 --- a/gcc/go/gofrontend/expressions.cc +++ b/gcc/go/gofrontend/expressions.cc @@ -8608,6 +8608,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) |