# HG changeset patch # User Tomas Lindquist Olsen # Date 1242400640 -7200 # Node ID 48747003a5de424e1198734b7507273a1aad89fe # Parent 59c2aa9def233126a535728604019dd23723d02f Set explicit alignment for normal global variables, ensures alignment is correct for globals with union type. diff -r 59c2aa9def23 -r 48747003a5de gen/declarations.cpp --- 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';