Issue 63874
Summary Clang: ABI incompatibility with MSVC on i686-windows for struct containing overaligned type
Labels llvm:codegen, ABI, platform:win32
Assignees rnk
Reporter erikdesjardins
    Somewhat related to #63257.

In https://reviews.llvm.org/D72114, a special case was added to pass overaligned arguments indirectly, to match MSVC. However, it doesn't quite match MSVC behavior. MSVC seems to apply the special case transitively, if any field of the struct contains an overaligned type, whereas Clang only applies the special case when the toplevel struct itself is overaligned.

For example, for the following struct definitions:

```c
__declspec(align(8))
struct Align
{
 uint64_t a;
    uint64_t b;
};

struct Wrap1Align
{
 struct Align a;
    uint32_t b;
};

struct Wrap2Align {
 struct Wrap1Align a;
    uint8_t b;
};
```

MSVC passes all three indirectly, whereas Clang only passes `Align` indirectly.

Demo: https://godbolt.org/z/766G9zx53
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to