rjmccall wrote:

My argument above is that the x86-64 psABI requires us to not pass `&t` as the 
indirect return address.  Following that rule fixes the problem here even if we 
keep doing NRVO.

I think the approximate shape of the correct fix here is to:
(1) Use the function Eli pointed out to check whether the initializer refers to 
the variable being initialized.
(2) Propagate that information down in CodeGen when we're emitting into an 
address.
(3) When emitting a call into an address, if the return value is trivially 
copyable and the initialized address is potentially aliased, emit into a 
temporary and then copy.

https://github.com/llvm/llvm-project/pull/101038
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to