[llvm-bugs] [Bug 34272] New: abi for passing empty structures on x86 changed between recently

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Aug 21 20:29:55 PDT 2017


            Bug ID: 34272
           Summary: abi for passing empty structures on x86 changed
                    between recently
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: vargaz at gmail.com
                CC: llvm-bugs at lists.llvm.org

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;

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

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:


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.

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170822/0159e65d/attachment.html>

More information about the llvm-bugs mailing list