diff gen/declarations.cpp @ 1357:48747003a5de

Set explicit alignment for normal global variables, ensures alignment is correct for globals with union type.
author Tomas Lindquist Olsen <tomas.l.olsen gmail com>
date Fri, 15 May 2009 17:17:20 +0200
parents 79758fd2f48a
children 855f188aab7a
line wrap: on
line diff
--- a/gen/declarations.cpp	Fri May 15 17:05:35 2009 +0200
+++ b/gen/declarations.cpp	Fri May 15 17:17:20 2009 +0200
@@ -136,6 +136,9 @@
         llvm::GlobalVariable* gvar = new llvm::GlobalVariable(_type,_isconst,_linkage,NULL,_name,gIR->module);
         this->ir.irGlobal->value = gvar;
 
+        // set the alignment
+        gvar->setAlignment(this->type->alignsize());
+
         if (Logger::enabled())
             Logger::cout() << *gvar << '\n';