[PATCH 2/2] i386: Fix va_arg of 256/512-bit vectors from a SysV va_list

LIU Hao lh_mouse@126.com
Thu Oct 1 12:59:19 GMT 2026


在 2026-10-1 20:11, Jonathan Yong 写道:
> On 10/1/26 06:47, Uros Bizjak wrote:
>> On Wed, Sep 30, 2026 at 7:48 PM Oleg Tolmatcev <oleg.tolmatcev@gmail.com> wrote:
>>>
>>> A SysV caller passes unnamed 256 and 512-bit vectors on the stack.
>>> For a SysV va_list, ix86_gimplify_va_arg only reads them from the stack
>>> if the function containing the va_arg uses the SysV ABI; in an MS ABI
>>> function it reads them from the register save area instead.  Always
>>> read them from the stack.
>>>
>>> va-arg-abi-attribute-2.c passes on x86_64-w64-mingw32.
>>>
>>> gcc/ChangeLog:
>>>
>>>          * config/i386/i386.cc (ix86_gimplify_va_arg): Always read unnamed
>>>          256 and 512-bit vectors from the stack.
>>>
>>> gcc/testsuite/ChangeLog:
>>>
>>>          * gcc.target/i386/va-arg-abi-attribute-2.c: New test.
>>>          * gcc.target/i386/va-arg-abi-attribute-3.c: New test.
>>
>> LGTM, but please also CC mingw maintainer on MS ABI stuff.
>>
>> Thanks,
>> Uros.
>>
>>> Signed-off-by: Oleg Tolmatcev <oleg.tolmatcev@gmail.com>
>>> ---
>>>   gcc/config/i386/i386.cc                       |  8 +---
>>>   .../gcc.target/i386/va-arg-abi-attribute-2.c  | 46 ++++++++++++++++++
>>>   .../gcc.target/i386/va-arg-abi-attribute-3.c  | 47 +++++++++++++++++++
>>>   3 files changed, 95 insertions(+), 6 deletions(-)
>>>   create mode 100644 gcc/testsuite/gcc.target/i386/va-arg-abi-attribute-2.c
>>>   create mode 100644 gcc/testsuite/gcc.target/i386/va-arg-abi-attribute-3.c
> + LH.

The change looks good to me.

For MS ABI, `va_list` is `char*` and is short-circuit'd by `is_va_list_char_pointer()`, so the code path 
in the patch really looks specific to SysV ABI.

And also it shouldn't check for `TARGET_64BIT_MS_ABI` which is a global setting.



-- 
Best regards,
LIU Hao
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature.asc
Type: application/pgp-signature
Size: 840 bytes
Desc: OpenPGP digital signature
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20261001/d3b34b64/attachment-0001.sig>


More information about the Gcc-patches mailing list