Bug 58901 - Breaking ABI change on 32 bits with xcode 8.3 or newer
Summary: Breaking ABI change on 32 bits with xcode 8.3 or newer
Alias: None
Product: Runtime
Classification: Mono
Component: JIT (show other bugs)
Version: master
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2017-08-19 03:53 UTC by Zoltan Varga
Modified: 2017-09-07 17:11 UTC (History)
6 users (show)

See Also:
Tags: bugpool
Is this bug a regression?: ---
Last known good build:


Description Zoltan Varga 2017-08-19 03:53:21 UTC
The problem seems to be caused by the handling of empty structures. For this code:
typedef struct {
} AStruct;

AStruct ret (int a) {
        AStruct s;
        if (a == 42)
                printf (".\n");
        return s;

xcode73-s clang -emit-llvm generates:

define void @ret(%struct.AStruct* noalias sret %agg.result, i32 %a) #0 {

xcode83-s clang generates:

define void @ret(i32) #0 {

The empty structure is no longer passed to the llvm backend at all, causing it to generate different code.
Comment 1 Zoltan Varga 2017-08-19 04:01:22 UTC
The change which introduced this seems to be clang bc350ca21c51e341427c7f96dc21fc1bd8f73a2b.
Comment 2 Bernhard Urban 2017-08-21 15:36:35 UTC
reminder: please revert https://github.com/mono/mono/pull/5411 once this bug is resolved.
Comment 3 Zoltan Varga 2017-08-22 03:36:35 UTC
Comment 4 Zoltan Varga 2017-08-22 18:52:48 UTC
Comment 5 Marek Safar 2017-08-22 22:04:03 UTC
I think even if this is a corner case we should follow and update to the latest ABI unless we get clear response that they are reverting the change.

We could introduce LEGACY_CLANG_EMPTY_STRUCT to control the behaviour.

Note You need to log in before you can comment on or make changes to this bug.