public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Ian Lance Taylor <iant@golang.org>
To: gcc-patches <gcc-patches@gcc.gnu.org>,
		"gofrontend-dev@googlegroups.com"
	<gofrontend-dev@googlegroups.com>
Subject: Go patch committed: Traverse types of call expression
Date: Sun, 01 Nov 2015 20:46:00 -0000	[thread overview]
Message-ID: <CAOyqgcVZ-h8ywetRusWWv9aAoOfjUEctUJUmWUefeTT+VKoaSA@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 636 bytes --]

GCC PR 67968 provides a test case that causes a gccgo crash.  The
crash is because 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.  Bootstrapped and
ran Go testsuite on x86_64-pc-linux-gnu.  Committed to mainline and 5
branch.

Test case sent out for the master testsuite as https://golang.org/cl/16532 .

Ian

[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 1374 bytes --]

Index: gcc/go/gofrontend/MERGE
===================================================================
--- gcc/go/gofrontend/MERGE	(revision 229636)
+++ gcc/go/gofrontend/MERGE	(working copy)
@@ -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.
Index: gcc/go/gofrontend/expressions.cc
===================================================================
--- gcc/go/gofrontend/expressions.cc	(revision 229541)
+++ gcc/go/gofrontend/expressions.cc	(working copy)
@@ -8608,6 +8608,16 @@ Builtin_call_expression::do_export(Expor
 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)

                 reply	other threads:[~2015-11-01 20:46 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAOyqgcVZ-h8ywetRusWWv9aAoOfjUEctUJUmWUefeTT+VKoaSA@mail.gmail.com \
    --to=iant@golang.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=gofrontend-dev@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).