changeset 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 59c2aa9def23
children 78038e540342 34f2fd925de3
files gen/declarations.cpp
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
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';