Hi, This is a follow-up to the message I sent to cfe-dev about unexpected behaviour on transparent unions [1].
As I mentioned there, currently when unions marked with the transparent_union attribute are used as function arguments, the declared function gets called with the union instead of the calling convention of the first field in the transparent union as is required by the description [2]. Looking at the commit log, most of the current implementation of the transparent_union attribute support origins from r70419, which actually mentions the lack of proper CodeGen support [3]. Attached is a patch that tries to improve the situation by converting the type to the first field of the union, but there are a couple of things I am not completely satisfied with, so feedback on this patch is most welcome. The thing that bugs me most is the conversion in classifyArgument in lib/CodeGen/TargetInfo.cpp. Since this is ABI specific, every ABI has to do the conversion, which seems sub-optimal to me. Stefan [1] http://lists.cs.uiuc.edu/pipermail/cfe-dev/2012-July/022672.html [2] http://gcc.gnu.org/onlinedocs/gcc/Type-Attributes.html [3] http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20090427/016496.html
CodeGen_support_for_transparent_union.patch
Description: Binary data
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
