]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
A variable with a preinit block requires an intialization function.
authorIan Lance Taylor <ian@gcc.gnu.org>
Thu, 23 Dec 2010 01:35:27 +0000 (01:35 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Thu, 23 Dec 2010 01:35:27 +0000 (01:35 +0000)
From-SVN: r168198

gcc/go/gofrontend/gogo.cc

index aa62ce6d868b0c88c504b7cab1f707d14d657b5c..9e51b63e62f0a71083fcbddb9fcb5b6837444ab3 100644 (file)
@@ -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;