This patch to the Go frontend avoids a compiler crash on the real
declaration of a previously-declared type with an existing method.
This avoids a compiler crash on invalid code, and fixes GCC PR 90272.
Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu.  Committed
to mainline.

Ian
Index: gcc/go/gofrontend/MERGE
===================================================================
--- gcc/go/gofrontend/MERGE     (revision 270615)
+++ gcc/go/gofrontend/MERGE     (working copy)
@@ -1,4 +1,4 @@
-b117b468264665cfe6ec2cf3affb48330a704fa7
+9476f6183791477dd9b883f51e2a46b224227735
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
Index: gcc/go/gofrontend/gogo.cc
===================================================================
--- gcc/go/gofrontend/gogo.cc   (revision 270564)
+++ gcc/go/gofrontend/gogo.cc   (working copy)
@@ -7816,7 +7816,8 @@ Type_declaration::define_methods(Named_t
        p != this->methods_.end();
        ++p)
     {
-      if (!(*p)->func_value()->is_sink())
+      if ((*p)->is_function_declaration()
+         || !(*p)->func_value()->is_sink())
        nt->add_existing_method(*p);
     }
 }

Reply via email to