On Tue, Oct 27, 2026 at 02:19:37PM +0100, Jakub Jelinek wrote: > 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.
Ok, I will have a look. > > > 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)? I like this idea. I guess we wouldn't want to emit a warning over too many GCC releases, i.e., after a while I would have hoped that the dust settled and we could remove the warning. Maybe after two to three releases? Speaking of warning, I also realize that sometimes only a note is emitted. Regarding www docs. I already came up with a htdocs/gcc-17/porting_to.html entry and, now, I see that all psabi warnings across targets refer to changes.html which I will then use, too. Cheers, Stefan
