This patch by Chris Manghane fixes the Go frontend to issue an error
for invalid receiver types, rather than crashing. This fixes
https://golang.org/issue/11557 . Bootstrapped and ran Go testsuite on
x86_64-unknown-linux-gnu. Committed to mainline.
Ian
Index: gcc/go/gofrontend/MERGE
===================================================================
--- gcc/go/gofrontend/MERGE (revision 226846)
+++ gcc/go/gofrontend/MERGE (working copy)
@@ -1,4 +1,4 @@
-fc9da313b4f5c13b4ac3bdddd98e699fd1c89613
+448d30b696461a39870d1b8beb1195e411300bfd
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 226846)
+++ gcc/go/gofrontend/gogo.cc (working copy)
@@ -1927,7 +1927,11 @@ Gogo::declare_function(const std::string
return ftype->add_method_declaration(name, NULL, type, location);
}
else
- go_unreachable();
+ {
+ error_at(type->receiver()->location(),
+ "invalid receiver type (receiver must be a named type)");
+ return Named_object::make_erroneous_name(name);
+ }
}
}