public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Ian Lance Taylor <iant@google.com>
To: gcc-patches@gcc.gnu.org, gofrontend-dev@googlegroups.com
Subject: Go patch committed: Don't finalize methods more than once
Date: Tue, 21 Dec 2010 22:53:00 -0000	[thread overview]
Message-ID: <mcrvd2mlpsq.fsf@google.com> (raw)

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

This patch to the Go frontend prevents the compiler from trying to
finalize the methods for a type more than once.  This avoids an endless
loop in an invalid case.  Bootstrapped and ran Go testsuite on
x86_64-unknown-linux-gnu.  Committed to mainline.

Ian


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: methods --]
[-- Type: text/x-diff, Size: 574 bytes --]

diff -r 7975dbfdedb1 go/types.cc
--- a/go/types.cc	Tue Dec 21 13:12:12 2010 -0800
+++ b/go/types.cc	Tue Dec 21 14:29:10 2010 -0800
@@ -3698,6 +3698,8 @@
 void
 Struct_type::finalize_methods(Gogo* gogo)
 {
+  if (this->all_methods_ != NULL)
+    return;
   Type::finalize_methods(gogo, this, this->location_, &this->all_methods_);
 }
 
@@ -6615,6 +6617,9 @@
 void
 Named_type::finalize_methods(Gogo* gogo)
 {
+  if (this->all_methods_ != NULL)
+    return;
+
   if (this->local_methods_ != NULL
       && (this->points_to() != NULL || this->interface_type() != NULL))
     {

                 reply	other threads:[~2010-12-21 22:33 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=mcrvd2mlpsq.fsf@google.com \
    --to=iant@google.com \
    --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).