* Go patch committed: Don't crash if a temporary is not defined
@ 2010-12-22 16:57 Ian Lance Taylor
0 siblings, 0 replies; only message in thread
From: Ian Lance Taylor @ 2010-12-22 16:57 UTC (permalink / raw)
To: gcc-patches, gofrontend-dev
[-- Attachment #1: Type: text/plain, Size: 193 bytes --]
This patch to the Go frontend avoids a compiler crash if a temporary is
not defined due to errors. Bootstrapped and ran Go testsuite on
x86_64-unknown-linux-gnu. Committed to mainline.
Ian
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: temporary --]
[-- Type: text/x-diff, Size: 943 bytes --]
diff -r f0539ea34ab9 go/statements.cc
--- a/go/statements.cc Wed Dec 22 07:55:23 2010 -0800
+++ b/go/statements.cc Wed Dec 22 08:17:25 2010 -0800
@@ -299,6 +299,19 @@
return this->type_ != NULL ? this->type_ : this->init_->type();
}
+// Return the tree for the temporary variable.
+
+tree
+Temporary_statement::get_decl() const
+{
+ if (this->decl_ == NULL)
+ {
+ gcc_assert(saw_errors());
+ return error_mark_node;
+ }
+ return this->decl_;
+}
+
// Traversal.
int
diff -r f0539ea34ab9 go/statements.h
--- a/go/statements.h Wed Dec 22 07:55:23 2010 -0800
+++ b/go/statements.h Wed Dec 22 08:17:25 2010 -0800
@@ -487,11 +487,7 @@
// Return the tree for the temporary variable itself. This should
// not be called until after the statement itself has been expanded.
tree
- get_decl() const
- {
- gcc_assert(this->decl_ != NULL);
- return this->decl_;
- }
+ get_decl() const;
protected:
int
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2010-12-22 16:21 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-22 16:57 Go patch committed: Don't crash if a temporary is not defined Ian Lance Taylor
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).