This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Go patch committed: Determine types in variable preinit blocks
- 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: Thu, 10 Feb 2011 14:35:35 -0800
- Subject: Go patch committed: Determine types in variable preinit blocks
The Go frontend uses a preinit block for global variables in a few
cases, such as when a global variable is initialized as part of a
tuple. However, I forgot to run the type determination pass over those
preinit blocks. This patch fixes that oversight. Bootstrapped and ran
Go testsuite on x86_64-unknown-linux-gnu. Committed to mainline.
Ian
diff -r 82f9ed04cbc2 go/gogo.cc
--- a/go/gogo.cc Thu Feb 10 13:45:10 2011 -0800
+++ b/go/gogo.cc Thu Feb 10 14:31:12 2011 -0800
@@ -3357,6 +3357,9 @@
void
Variable::determine_type()
{
+ if (this->preinit_ != NULL)
+ this->preinit_->determine_types();
+
// A variable in a type switch with a nil case will have the wrong
// type here. It will have an initializer which is a type guard.
// We want to initialize it to the value without the type guard, and