Permalink
Browse files

SysV x64 ABI: Handle further special case for aggregates

  • Loading branch information...
kinke committed Nov 19, 2018
1 parent ab38d73 commit 8dc3376cc3b00b88f124e418b0d6a8fcfedd7a10
Showing with 9 additions and 2 deletions.
  1. +8 −1 dmd/argtypes_sysv_x64.d
  2. +1 −1 tests/d2/dmd-testsuite
@@ -147,7 +147,7 @@ Classification classify(Type t, size_t size)
extern (C++) final class ToClassesVisitor : Visitor
{
const size_t size;
const int numEightbytes;
int numEightbytes;
Class[4] result = Class.NoClass;
this(size_t size)
@@ -390,5 +390,12 @@ extern (C++) final class ToClassesVisitor : Visitor
if (c != Class.SSEUp)
return memory();
}
// Undocumented special case for aggregates with the 2nd eightbyte
// consisting of padding only (`struct S { align(16) int a; }`).
// clang only passes the first eightbyte in that case, so let's do the
// same.
if (numEightbytes == 2 && result[1] == Class.NoClass)
numEightbytes = 1;
}
}

0 comments on commit 8dc3376

Please sign in to comment.