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

            Bug ID: 86727
           Summary: Struct argument in xmm0 register instead of rcx on
                    Win64
           Product: gcc
           Version: 8.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: bart at bartjanssens dot org
  Target Milestone: ---

Created attachment 44462
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44462&action=edit
Test case

When passing a struct containing a single value of type double, the argument is
fetched from the %xmm0 register, where the %rcx register should actually be
used on 64 bit Windows. Both mingw GCC 6.4.0 and 8.2.0 read the argument like
this:

movsd   %xmm0, 16(%rbp)

Clang and MSVC both read correctly from %rcx.

Attached is a self-contained example, assembly dumped with

x86_64-w64-mingw32-gcc -S -o - -x c test.c

shows the problem. More discussion is also at:
https://github.com/JuliaLang/julia/issues/28325

When changing the field type to e.g. int or when adding extra fields to the
struct the problem goes away.

Reply via email to