alexfh 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." A standalone reproducer is here: https://gcc.godbolt.org/z/Ed1s15Kv5. The test passes when compiled with clang before this patch, and generates a bogus address sanitizer error after this patch. This only happens with `-march=haswell`. The affected code is: #include <unsupported/Eigen/CXX11/Tensor> #include <gtest/gtest.h> #include <gmock/gmock.h> #include <absl/types/span.h> template <typename Tensor> auto AsArray(const Tensor& t) -> absl::Span<const typename Tensor::Scalar> { return {t.data(), (size_t)t.size()}; } using testing::ElementsAre; int main() { using Tensor = Eigen::TensorFixedSize<float, Eigen::Sizes<2, 2>, Eigen::RowMajor, Eigen::DenseIndex>; Tensor a; a.setValues({{1, 2}, {3, 4}}); auto round = [](Tensor m) { return (m + 0.5f).cast<int>().cast<float>(); }; const Tensor t3 = round(a.log().exp()); EXPECT_THAT(AsArray(t3), ElementsAre(1, 2, 3, 4)); } The problem reproduces with `clang -std=c++17 -O3 -fsanitize=address -march=haswell`. I'm going to revert the commit. 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