[clang] fix: compatible C++ empty record with align UB with gcc (PR #72197)
John McCall via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 16 12:45:13 PST 2023
rjmccall wrote:
> This is the code I debug located. Seem the comment is out of date?
That seems like the right place to fix the issue, specifically the place below where it always passes a single `i8`. The right rule is to just fall through to the normal conventions for passing the argument if we don't decide to ignore it.
The comment isn't wrong, but it could be clearer. Let me suggest this:
> AAPCS64 does not say that empty records are ignored as arguments,
> but other compilers do so in certain situations, and we copy that behavior.
> Those situations are in fact language-mode-specific, which seems really
> unfortunate, but it's something we just have to accept. If this doesn't
> apply, just fall through to the standard argument-handling path.
> Darwin overrides the psABI here to ignore all empty records in all modes.
> This issue [1711cc9](https://github.com/llvm/llvm-project/commit/1711cc930bda8d27e87a2092bd220c18e4600c98) point that when pass the empty class the `va_list` will get out of sync.
That seems like something we should fix, yeah. Generally `va_list` handling needs to do the same kind of classification that argument-passing does.
https://github.com/llvm/llvm-project/pull/72197
More information about the cfe-commits
mailing list