https://llvm.org/bugs/show_bug.cgi?id=26162
Bug ID: 26162
Summary: Incompatible with GCC abi on Linux AArch64 for
zero-sized array GNU extension
Product: clang
Version: 3.7
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: Frontend
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
Classification: Unclassified
The following code compiles differently in clang and GCC
```
struct large_ha {
struct {
double a[0];
};
double b;
double c;
double d;
};
struct large_ha bar(struct large_ha v)
{
return v;
}
```
Clang treats this as a homogeneous floating-point aggregate (HFA) and pass it
in the register for both the function argument and return value (in the same
register) and therfore the function body is,
```
bar: // @bar
// BB#0:
ret
```
GCC seems to treat this as non-HFA and therefore uses `sret` for the return
value and pass the argument by reference and the code generated is,
```
bar:
mov x1, x0
mov x0, x8
ldp x2, x3, [x1]
ldr x1, [x1, 16]
stp x2, x3, [x8]
str x1, [x8, 16]
ret
```
Giving the embedded struct a name makes no difference on either of them.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs