This patch to the Go frontend avoids a crash if an error causes us to write out type functions too late. Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu. Committed to mainline.
Ian
diff -r 90c26bab1684 go/gogo.h --- a/go/gogo.h Wed Mar 07 08:04:32 2012 -0800 +++ b/go/gogo.h Wed Mar 07 13:50:47 2012 -0800 @@ -398,6 +398,11 @@ void write_specific_type_functions(); + // Whether we are done writing out specific type functions. + bool + specific_type_functions_are_written() const + { return this->specific_type_functions_are_written_; } + // Traverse the tree. See the Traverse class. void traverse(Traverse*); diff -r 90c26bab1684 go/types.cc --- a/go/types.cc Wed Mar 07 08:04:32 2012 -0800 +++ b/go/types.cc Wed Mar 07 13:50:47 2012 -0800 @@ -1790,6 +1790,12 @@ { Location bloc = Linemap::predeclared_location(); + if (gogo->specific_type_functions_are_written()) + { + go_assert(saw_errors()); + return; + } + Named_object* hash_fn = gogo->start_function(hash_name, hash_fntype, false, bloc); gogo->start_block(bloc);