From patchwork Fri Dec 24 00:48:51 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Go patch committed: Avoid endless loop checking for pointer type Date: Thu, 23 Dec 2010 14:48:51 -0000 From: Ian Taylor X-Patchwork-Id: 76562 Message-Id: To: gcc-patches@gcc.gnu.org, gofrontend-dev@googlegroups.com This patch to the Go frontend avoids an endless type loop when checking whether an invalid type is or contains a pointer. Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu. Committed to mainline. Ian diff -r 5382ded0e9b4 go/types.cc --- a/go/types.cc Thu Dec 23 16:32:07 2010 -0800 +++ b/go/types.cc Thu Dec 23 16:46:39 2010 -0800 @@ -3253,26 +3253,35 @@ protected: bool do_has_pointer() const - { gcc_unreachable(); } + { + gcc_assert(saw_errors()); + return false; + } tree do_get_tree(Gogo*); tree do_get_init_tree(Gogo*, tree, bool) - { gcc_unreachable(); } + { + gcc_assert(saw_errors()); + return error_mark_node; + } Expression* do_type_descriptor(Gogo*, Named_type*) - { gcc_unreachable(); } + { + gcc_assert(saw_errors()); + return Expression::make_error(UNKNOWN_LOCATION); + } void do_reflection(Gogo*, std::string*) const - { gcc_unreachable(); } + { gcc_assert(saw_errors()); } void do_mangled_name(Gogo*, std::string*) const - { gcc_unreachable(); } + { gcc_assert(saw_errors()); } private: // The expression being called.