-
Notifications
You must be signed in to change notification settings - Fork 14.5k
Closed
Labels
ABIApplication Binary InterfaceApplication Binary InterfacebugzillaIssues migrated from bugzillaIssues migrated from bugzillac++
Description
Bugzilla Link | 45420 |
Resolution | FIXED |
Resolved on | Apr 16, 2020 10:31 |
Version | trunk |
OS | Windows NT |
Reporter | LLVM Bugzilla Contributor |
CC | @DougGregor,@zygoloid,@rnk |
Extended Description
According to documentation,
https://docs.microsoft.com/en-us/cpp/build/reference/zp-struct-member-alignment?view=vs-2019
Visual studio interprets /Zp8 as a way to pack structure members, but it doesn't not change alignment of such struct itself.
clang-cl interprets it similar to -fpack-struct=8, and so /Zp8 flag is working significantly differently in msvc and clang-cl.
According to documentation WindowsSDK headers has to be compiled with /Zp8 flag, and so it can cause (and is causing in some projects) issues with using clang-cl as replacement for msvc.
the following sample:
#include <emmintrin.h>
struct A{__m128 a[1];};
static_assert(alignof(A) == 16, "should be aligned");
won't compile with /Zp8 flag with clang-cl, but it will in msvc.
Run-time sample:
Metadata
Metadata
Assignees
Labels
ABIApplication Binary InterfaceApplication Binary InterfacebugzillaIssues migrated from bugzillaIssues migrated from bugzillac++