This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Go patch committed: Avoid compiler crash
- From: Ian Lance Taylor <iant at google dot com>
- To: gcc-patches at gcc dot gnu dot org, gofrontend-dev at googlegroups dot com
- Date: Wed, 28 Mar 2012 15:22:23 -0700
- Subject: Go patch committed: Avoid compiler crash
This patch from RÃmy Oudompheng avoids a Go frontend crash on the valid
Go code
package p
var v struct{ I }
type I interface{}
Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu.
Committed to mainline and 4.7 branch.
Ian
diff -r 652c8036e264 go/gogo.cc
--- a/go/gogo.cc Wed Mar 28 14:32:28 2012 -0700
+++ b/go/gogo.cc Wed Mar 28 15:12:54 2012 -0700
@@ -1653,8 +1653,12 @@
}
case Type::TYPE_STRUCT:
+ // Traverse the field types first in case there is an embedded
+ // field with methods that the struct should inherit.
+ if (t->struct_type()->traverse_field_types(this) == TRAVERSE_EXIT)
+ return TRAVERSE_EXIT;
t->struct_type()->finalize_methods(this->gogo_);
- break;
+ return TRAVERSE_SKIP_COMPONENTS;
default:
break;