Allow align(1) for global variables.

This reverts a39997d326, and fixes the invalid tests in std.conv.
This commit is contained in:
Johan Engelen 2016-10-11 21:37:45 +02:00
parent a90fdfe624
commit 7e572e6f03
3 changed files with 13 additions and 7 deletions

View file

@ -846,10 +846,10 @@ void DtoResolveVariable(VarDeclaration *vd) {
linkage, nullptr, llName, vd->isThreadlocal());
getIrGlobal(vd)->value = gvar;
// Set the alignment and use the target pointer size as lower bound.
unsigned alignment =
std::max(DtoAlignment(vd), gDataLayout->getPointerSize());
gvar->setAlignment(alignment);
// Set the alignment (it is important not to use type->alignsize because
// VarDeclarations can have an align() attribute independent of the type
// as well).
gvar->setAlignment(DtoAlignment(vd));
applyVarDeclUDAs(vd, gvar);