From 1e9402cb3d04add863c5f662b346c8f5f180ebb7 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Thu, 23 Dec 2010 01:35:27 +0000 Subject: [PATCH] A variable with a preinit block requires an intialization function. From-SVN: r168198 --- gcc/go/gofrontend/gogo.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gcc/go/gofrontend/gogo.cc b/gcc/go/gofrontend/gogo.cc index aa62ce6d868..9e51b63e62f 100644 --- a/gcc/go/gofrontend/gogo.cc +++ b/gcc/go/gofrontend/gogo.cc @@ -1384,7 +1384,11 @@ Gogo::determine_types() // If this is a global variable which requires runtime // initialization, we need an initialization function. - if (!variable->is_global() || variable->init() == NULL) + if (!variable->is_global()) + ; + else if (variable->has_pre_init()) + this->need_init_fn_ = true; + else if (variable->init() == NULL) ; else if (variable->type()->interface_type() != NULL) this->need_init_fn_ = true; -- 2.11.4.GIT