[PATCH] D118350: [Clang][Sema][AIX][PowerPC] Emit byval alignment warning only when struct member is passed to a function
Sean Fertile via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Feb 17 07:15:47 PST 2022
sfertile added a comment.
Hey Zarko. I really like how we only issue the warning when the struct is used, however I think this is still overly broad because of where the incompatibility lies between xlc and clang. I believe the layout of the structures will be the same for both compilers, and globals of this type will have the same alignment restrictions. A function like `void baz(int *);` will be compatible between the 2 compilers since the argument is just a pointer. The difference occurs when passing the structure by value on the stack, where xlc doesn't align the struct to the expected alignment, and clang/llvm does. Since the incompatibility is in the calling convention only when the struct is passed byval, that should be the only time we emit the diagnostic.
There are 2 other things we should verify since I'm not sure if they are compatible or not:
1. When passing these structures byval but in argument passing registers, I'm guessing that xlc doesn't skip registers whose image in the PSA is under-aligned while llvm will.
2. Whether xlc passes these misaligned when its done through va_args.
The answers to those 2 questions will determine if we need to warn for all byval arguments that have alignments from attribute that is greater than 8, or if we can limit it a bit further.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D118350/new/
https://reviews.llvm.org/D118350
More information about the cfe-commits
mailing list