https://bugs.llvm.org/show_bug.cgi?id=45420

            Bug ID: 45420
           Summary: clang-cl incorrectly interprets /Zp8 flag
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected],
                    [email protected]

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:

https://godbolt.org/z/qh7Dbg

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to