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

Denis Zobnin via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 4 09:43:19 PST 2016


d.zobnin.bugzilla added a comment.

Thank you for the review!

David, I started from the assertion failure and was going up the call stack trying to understand what should be changed to make the assertion go away. In shouldReturnTypeInRegister() function there is isRegisterSize(Size) check for i386, which returns false for 0-sized types, so I naively assumed that for MCU we missed the 0-case check. I must have read the ABI more carefully...

While searching for a correct solution for this, I saw that 'void' return type is handled in classifyReturnType() by returning ABIArgInfo::getIgnore(). According to the comments:

  /// Ignore - Ignore the argument (treat as void). Useful for void and
  /// empty structs.
  Ignore,

Does it mean that we can treat empty structs and unions in return type as void in this case?


http://reviews.llvm.org/D16808





More information about the cfe-commits mailing list