[Bug c++/52792] this pointer and return pointer are passed in wrong order when ms_abi is used (x86_64)

2020-11-20 Thread p_hampson at wargaming dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52792

Paul "TBBle" Hampson  changed:

   What|Removed |Added

 CC|    |p_hampson at wargaming dot net

--- Comment #6 from Paul "TBBle" Hampson  ---
Since this came up on Stack Overflow, I thought I'd note the outcomes here.

https://stackoverflow.com/a/62880979/166389

The original report is accurate, as the ordering of "first argument hidden
this" and "first argument return-value pointer" differs in gcc compared to msvc
and clang.

It's ambiguous in the MSVC ABI documentation as the two behaviours are
specified in different document sets and both claim to become "the first
argument". I have raised an issue with Microsoft about this:
https://github.com/MicrosoftDocs/windows-driver-docs/issues/2586

There's also another related C++ issue (the actual SO question that triggered
my investigation) as gcc will return a user-defined type (struct) by value in
RAX for power-of-two-sized C++03 POD types, but the the MSVC ABI documentation
(and observed behaviour in msvc and clang) specify that
return-struct-in-register is only supported
> from global functions and static member functions.

https://docs.microsoft.com/en-us/cpp/build/x64-calling-convention#return-values

None of the examples here trigger this bug, as they all use sufficiently-large
aggregates that they would not be candidates for return-struct-in-register
anyway.

I was only looking at the x64 documentation, but minimal testing bears out the
same results for 32-bit MSVC C++ ABI.

[Bug preprocessor/47857] Pragma once warning when compiling PCH

2015-01-06 Thread p_hampson at wargaming dot net
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47857

Paul TBBle Hampson p_hampson at wargaming dot net changed:

   What|Removed |Added

 CC||p_hampson at wargaming dot net

--- Comment #6 from Paul TBBle Hampson p_hampson at wargaming dot net ---
This looks like a specific instance or duplicate of the much older bug 9471.