Issue |
144709
|
Summary |
Clang: 64-bit SPARC doesn't align struct arguments as required by ABI
|
Labels |
clang
|
Assignees |
|
Reporter |
beetrees
|
The [64-bit SPARC calling convention](https://sparc.org/wp-content/uploads/2014/01/SCD.2.4.1.pdf.gz) 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:
```c
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](https://godbolt.org/z/h9Me7ojW6)).
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs