On Tue, Oct 27, 2026 at 01:44:40PM +0100, Stefan Schulze Frielinghaus wrote:
> From: Stefan Schulze Frielinghaus <[email protected]>
>
> Starting with r0-104773-g0d697034b7eecd which landed in GCC 4.6 (which
> introduced initial C++11 and std::nullptr_t support), arguments of type
> nullptr_t / std::nullptr_t / decltype(nullptr) are passed in registers.
> However, return values are erroneously returned in memory violating the
> psABI.
>
> Fixed by handling NULLPTR_TYPE in s390_return_in_memory, similarly to
> how it is already handled in s390_function_arg_integer, so that it is
> returned in a register.
>
> For C programs the effect/breakage is probably quite limited. However,
> I'm a bit worried about C++ code. Any thoughts about this? Clang
> passes and returns correctly in registers.
>
> Background: I stumbled across this when looking into PR126938 which
> reminds me that I have to be on a lookout once META_TYPE becomes
> available.
META_TYPE is not coming back, what we have for decltype (^^::) is
right now OPAQUE_TYPE with scalar mode. That should be supposedly
treated similarly to NULLPTR_TYPE in the s390x backend.
> gcc/ChangeLog:
>
> * config/s390/s390.cc (s390_return_in_memory): Handle
> NULLPTR_TYPE.
Shouldn't GCC emit a -Wpsabi warning in these cases (that the ABI of
returning of std::nullptr_t changed in GCC 17)?
Jakub