https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64384
Matheus Izvekov <mizvekov at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mizvekov at gmail dot com
--- Comment #7 from Matheus Izvekov <mizvekov at gmail dot com> ---
So this is still a problem in GCC 10.1.
Per
https://docs.microsoft.com/en-us/cpp/build/x64-calling-convention?view=vs-2019
What GCC does would be correct according to that spec. But in practice, MSVC
does different, and windows DLLs expect what MSVC does.
So I have stumbled on this problem with D3D12, calling
GetCPUDescriptorHandleForHeapStart method on ID3D12DescriptorHeap object.
Here is definition of this method from SDK:
```
virtual D3D12_CPU_DESCRIPTOR_HANDLE STDMETHODCALLTYPE
GetCPUDescriptorHandleForHeapStart( void) = 0;
```
Returned aggregate is just a boxed SIZE_T:
```
typedef struct D3D12_CPU_DESCRIPTOR_HANDLE { SIZE_T ptr; }
D3D12_CPU_DESCRIPTOR_HANDLE;
```
So it should be possible to return on register, but instead here is code from
that method (MASM syntax, taken from D3D12.dll):
```
CDescriptorHeap::GetCPUDescriptorHandleForHeapStart:
00007FF83AD6A3F0 mov rax,qword ptr [rcx+0D0h]
00007FF83AD6A3F7 mov qword ptr [rdx],rax
00007FF83AD6A3FA mov rax,rdx
00007FF83AD6A3FD ret
```