Open
Description
The 64-bit SPARC calling convention states:
Structure or union types larger than eight bytes, and up to sixteen bytes in size are assigned to two consecutive
parameter array words, and align according to the alignment requirements of the structure or at least to an eight-byte
boundary.
However, Clang fails to correctly align structs when passed by value. For instance, in this example:
struct Struct { _Alignas(16) int x; };
void bar(int pad, struct Struct value);
void foo(struct Struct input) {
bar(0, input);
}
Clang incorrectly passes value
8-aligned in o1
and o2
, whereas GCC correctly 16-aligns it and therefore passes it in o2
and o3
(compiler explorer).