vitalybuka added a comment.

In D74094#4633785 <https://reviews.llvm.org/D74094#4633785>, @alexfh wrote:

> This commit caused invalid AddressSanitizer: stack-use-after-scope errors in 
> our internal setup. Trying to create a standalone repro, but so far we think 
> that the patch is incorrect. @vitalybuka says "The patch seems wrong, callee 
> can return a reference to temp, so lifetime should be extended to full 
> expression."

I will lazily quote https://en.cppreference.com/w/cpp/language/lifetime, we can 
lookup the standard, all ask experts, if this is wrong:

  All temporary objects are destroyed as the last step in evaluating the 
full-expression that (lexically) contains the point where they were created, 
and if multiple temporary objects were created, they are destroyed in the order 
opposite to the order of creation. This is true even if that evaluation ends in 
throwing an exception.

And full-expression here is:

  const Tensor t3 = round(a.log().exp());




Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74094/new/

https://reviews.llvm.org/D74094

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to