在 6/2/21 8:31 PM, Marc Glisse 写道: > On Wed, 2 Jun 2021, Liu Hao via Gcc-help wrote: > >> However I expect there to be a better way to mitigate this: Is it possible to inform GCC to assume >> that the return slot cannot alias anything? > > I assume we will eventually fix > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80740 > it shouldn't be too hard assuming we agree that it is legal. > > I am not aware of a way for a user to add restrict on the hidden return pointer. > Does that testcase really exist in real codebases? I think it is reasonable to ignore such possibility. And since you mentioned Clang in that PR: Do you know that Clang assumes an `unsigned short` parameter that is passed via a 32-bit register has its all upper half bits as zeroes [1]? This of course violates psABI, but there has been no problem in practice. Pedantry is sometimes hindrance. [1] https://gcc.godbolt.org/z/4eoTPdoGx -- Best regards, Liu Hao