aboutsummaryrefslogtreecommitdiff
path: root/gcc/go
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2012-03-07 21:53:34 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2012-03-07 21:53:34 +0000
commitd111e30ef36f4c1f8e398fa48242eacb4b5da1b5 (patch)
tree6f2850c1de2dfed59c9802f25d1ba2fc47dfb347 /gcc/go
parent5ceb809d01f8acc5b646d531d7ef13834ca645c9 (diff)
downloadgcc-d111e30ef36f4c1f8e398fa48242eacb4b5da1b5.zip
gcc-d111e30ef36f4c1f8e398fa48242eacb4b5da1b5.tar.gz
gcc-d111e30ef36f4c1f8e398fa48242eacb4b5da1b5.tar.bz2
compiler: Don't crash if writing type functions too late due to error.
From-SVN: r185080
Diffstat (limited to 'gcc/go')
-rw-r--r--gcc/go/gofrontend/gogo.h5
-rw-r--r--gcc/go/gofrontend/types.cc6
2 files changed, 11 insertions, 0 deletions
diff --git a/gcc/go/gofrontend/gogo.h b/gcc/go/gofrontend/gogo.h
index 008c8a0..6c77c3b 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 d3a75f4..03f1b3e 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);