[PATCH] D16808: [MCU] PR26438: Fix assertion failure on function returning an empty struct or union

Alexander Kyte via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 22 10:17:18 PDT 2017


alexanderkyte added a comment.

This change is causing mono's native interop with C code compiled from clang to break. After some investigation, we're tracked bitcode differences between tests that fail versus not. When we upgrade the compiler to Xcode 8.3, we see that code generated to call functions returning empty structs will now generate code that crashes.

This seems to be us trying to pass arguments assuming that clang exhibits the same behavior it used to. It is easy enough for us to generate code for what clang does now, but that code would break if forced to interact with C compiled by gcc and older clangs.

Is there a way for callers of clang-emitted code to detect which ABI clang is going to use when returning an empty struct? This ABI change does not seem to admit backwards compatibility.

xcode73's clang -emit-llvm generates:

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

while xcode83's clang generates:

- define void @ret(i32) #0 {


Repository:
  rL LLVM

https://reviews.llvm.org/D16808





More information about the cfe-commits mailing list