<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Incompatible with GCC abi on Linux AArch64 for zero-sized array GNU extension"
   href="https://llvm.org/bugs/show_bug.cgi?id=26162">26162</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Incompatible with GCC abi on Linux AArch64 for zero-sized array GNU extension
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.7
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Frontend
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>yyc1992@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>