https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126927

--- Comment #2 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by H.J. Lu <[email protected]>:

https://gcc.gnu.org/g:ff1ab0ed4b5221f4d7d3eff2e7aadb826e2c9d9a

commit r17-3405-gff1ab0ed4b5221f4d7d3eff2e7aadb826e2c9d9a
Author: H.J. Lu <[email protected]>
Date:   Tue Aug 18 22:55:38 2026 +0800

    ms-sysv: Add call_do_test_unaligned

    We can't use

    void
    test (long a, long b, long c, long d, long e)
    {
      ...
      __asm__ __volatile__ ("subq $8,%%rsp":::"cc");
      ret = do_test_unaligned (a, b, c, d, e);
      __asm__ __volatile__ ("addq $8,%%rsp":::"cc");
      ...
    }

    to call do_test_unaligned, which is marked with ms_abi attribute, with
    an unaligned stack since GCC may save a function argument on stack and
    retrieve it from stack to pass it to do_test_unaligned.  When it happens,
    stack adjustment in asm statements can lead to a random value in the
    outgoing argument.  Add an assembly function, call_do_test_unaligned, to
    call do_test_unaligned with an unaligned stack.

            PR testsuite/126927
            * gcc.target/x86_64/abi/ms-sysv/do-test.S (call_do_test_unaligned):
            New.
            * gcc.target/x86_64/abi/ms-sysv/gen.cc (make_do_tests_decl):
            Replace do_test_unaligned with call_do_test_unaligned.
            (make_do_test): Remove asm statements with stack adjustment.

    Signed-off-by: H.J. Lu <[email protected]>

Reply via email to