Skip to content

Commit

Permalink
fix Issue 16466 - Alignment of reals inside structs on 32 bit OSX sho…
Browse files Browse the repository at this point in the history
…uld be 16, not 8
  • Loading branch information
WalterBright committed Sep 5, 2016
1 parent baa239e commit e4935fb
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/aggregate.d
Expand Up @@ -605,7 +605,7 @@ extern (C++) abstract class AggregateDeclaration : ScopeDsymbol

if (alignment == STRUCTALIGN_DEFAULT)
{
if (global.params.is64bit && memalignsize == 16)
if ((global.params.is64bit || global.params.isOSX) && memalignsize == 16)
{
}
else if (8 < memalignsize)
Expand Down
15 changes: 15 additions & 0 deletions test/runnable/xtest46.d
Expand Up @@ -7875,6 +7875,20 @@ void test16233()
Checked!(Checked!(int, void), void) x1;
}

/***************************************************/
// https://issues.dlang.org/show_bug.cgi?id=16466

void test16466()
{
static struct S
{
real r;
}
real r;
printf("S.alignof: %x, r.alignof: %x\n", S.alignof, r.alignof);
assert(S.alignof == r.alignof);
}

/***************************************************/

int main()
Expand Down Expand Up @@ -8192,6 +8206,7 @@ int main()
test15369();
test15638();
test16233();
test16466();

printf("Success\n");
return 0;
Expand Down

0 comments on commit e4935fb

Please sign in to comment.