* Go patch committed: Don't crash when some object is redefined as type
@ 2010-12-21 20:32 Ian Lance Taylor
0 siblings, 0 replies; only message in thread
From: Ian Lance Taylor @ 2010-12-21 20:32 UTC (permalink / raw)
To: gcc-patches, gofrontend-dev
[-- Attachment #1: Type: text/plain, Size: 259 bytes --]
This patch to the Go frontend avoids a crash when some object is
redefined as a type. This is invalid, but the compiler was assuming
that the definition succeeded. 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: crash --]
[-- Type: text/x-diff, Size: 790 bytes --]
diff -r ff7c1d0eb353 -r 7f448375b9ac go/gogo.cc
--- a/go/gogo.cc Tue Dec 21 10:08:48 2010 -0800
+++ b/go/gogo.cc Tue Dec 21 10:19:17 2010 -0800
@@ -881,7 +881,7 @@
{
Named_object* no = this->current_bindings()->add_type(name, NULL, type,
location);
- if (!this->in_global_scope())
+ if (!this->in_global_scope() && no->is_type())
no->type_value()->set_in_function(this->functions_.back().function);
}
@@ -901,7 +901,7 @@
{
Bindings* bindings = this->current_bindings();
Named_object* no = bindings->add_type_declaration(name, NULL, location);
- if (!this->in_global_scope())
+ if (!this->in_global_scope() && no->is_type_declaration())
{
Named_object* f = this->functions_.back().function;
no->type_declaration_value()->set_in_function(f);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2010-12-21 18:21 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-21 20:32 Go patch committed: Don't crash when some object is redefined as type 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).