<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - abi for passing empty structures on x86 changed between recently"
   href="https://bugs.llvm.org/show_bug.cgi?id=34272">34272</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>abi for passing empty structures on x86 changed between recently
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>-New Bugs
          </td>
        </tr>

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

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

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Take the following test case on osx:
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
#include <stdio.h>

typedef struct {
} Empty;

Empty ret_empty (int i) {
        Empty e;

        printf ("%d\n", i);
        return e;
}
<span class="quote">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>></span >

In xcode7.3, which has clang version:
Apple LLVM version 7.3.0 (clang-703.0.29)

Running
clang -emit-llvm empty.c
generates the following:
define void @ret_empty(%struct.Empty* noalias sret %agg.result, i32 %i) #0 {
i.e. the struct is returned using a hidden parameter

In xcode8.3 and later, it generates the following:
define void @ret_empty(i32) #0 {
i.e. the return value is simply ignored.

The change seems to have been introduced by:

<a href="https://github.com/llvm-mirror/clang/commit/bc350ca21c51e341427c7f96dc21fc1bd8f73a2b">https://github.com/llvm-mirror/clang/commit/bc350ca21c51e341427c7f96dc21fc1bd8f73a2b</a>

The commit talks about the MCU abi, but the change seems to impact normal
linux/osx etc. as well, which seems to be an abi break. Was this intentional,
or is this a regression ?
For the record, gcc generates the same code as xcode7.3.</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>