From: Ian Lance Taylor Date: Wed, 7 Mar 2012 21:53:34 +0000 (+0000) Subject: compiler: Don't crash if writing type functions too late due to error. X-Git-Tag: misc/gccgo-go1_1_2~4131 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d111e30ef36f4c1f8e398fa48242eacb4b5da1b5;p=thirdparty%2Fgcc.git compiler: Don't crash if writing type functions too late due to error. From-SVN: r185080 --- diff --git a/gcc/go/gofrontend/gogo.h b/gcc/go/gofrontend/gogo.h index 008c8a09872c..6c77c3bd9e94 100644 --- a/gcc/go/gofrontend/gogo.h +++ b/gcc/go/gofrontend/gogo.h @@ -398,6 +398,11 @@ class Gogo 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 --git a/gcc/go/gofrontend/types.cc b/gcc/go/gofrontend/types.cc index d3a75f425d14..03f1b3ea0c6e 100644 --- a/gcc/go/gofrontend/types.cc +++ b/gcc/go/gofrontend/types.cc @@ -1790,6 +1790,12 @@ Type::write_specific_type_functions(Gogo* gogo, Named_type* name, { 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);