- 
                Notifications
    You must be signed in to change notification settings 
- Fork 15k
[MemRef] Fix-forward use-after-scope in #164955 #165478
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
llvm#164955 has a use-after-scope (https://lab.llvm.org/buildbot/#/builders/169/builds/16454): ``` ==mlir-opt==3940651==ERROR: AddressSanitizer: stack-use-after-scope on address 0x6e1f6ba5c878 at pc 0x6336b214912a bp 0x7ffe607f1670 sp 0x7ffe607f1668 READ of size 4 at 0x6e1f6ba5c878 thread T0 #0 0x6336b2149129 in size /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/include/llvm/ADT/SmallVector.h:80:32 #1 0x6336b2149129 in operator[] /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/include/llvm/ADT/SmallVector.h:299:5 llvm#2 0x6336b2149129 in populateBoundsForShapedValueDim /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/mlir/lib/Dialect/MemRef/IR/ValueBoundsOpInterfaceImpl.cpp:113:43 ... ``` This patch attempts to fix-forward by stack-allocating reassocIndices, instead of taking a reference to a return value.
| @llvm/pr-subscribers-mlir-memref @llvm/pr-subscribers-mlir Author: Thurston Dang (thurstond) Changes#164955 has a use-after-scope (https://lab.llvm.org/buildbot/#/builders/169/builds/16454): This patch attempts to fix-forward by stack-allocating reassocIndices, instead of taking a reference to a return value. Full diff: https://github.com/llvm/llvm-project/pull/165478.diff 1 Files Affected: 
 diff --git a/mlir/lib/Dialect/MemRef/IR/ValueBoundsOpInterfaceImpl.cpp b/mlir/lib/Dialect/MemRef/IR/ValueBoundsOpInterfaceImpl.cpp
index 3aa801b48a2e9..69afbcadb0b07 100644
--- a/mlir/lib/Dialect/MemRef/IR/ValueBoundsOpInterfaceImpl.cpp
+++ b/mlir/lib/Dialect/MemRef/IR/ValueBoundsOpInterfaceImpl.cpp
@@ -107,7 +107,7 @@ struct CollapseShapeOpInterface
     assert(value == collapseOp.getResult() && "invalid value");
 
     // Multiply the expressions for the dimensions in the reassociation group.
-    const ReassociationIndices &reassocIndices =
+    const ReassociationIndices reassocIndices =
         collapseOp.getReassociationIndices()[dim];
     AffineExpr productExpr =
         cstr.getExpr(collapseOp.getSrc(), reassocIndices[0]);
 | 
| LLVM Buildbot has detected a new failure on builder  Full details are available at: https://lab.llvm.org/buildbot/#/builders/116/builds/20265 Here is the relevant piece of the build log for the reference | 
| 
 This is probably test flake. It had failed earlier today (https://lab.llvm.org/buildbot/#/builders/116/builds/20254) and subsequently passed. | 
llvm#164955 has a use-after-scope (https://lab.llvm.org/buildbot/#/builders/169/builds/16454): ``` ==mlir-opt==3940651==ERROR: AddressSanitizer: stack-use-after-scope on address 0x6e1f6ba5c878 at pc 0x6336b214912a bp 0x7ffe607f1670 sp 0x7ffe607f1668 READ of size 4 at 0x6e1f6ba5c878 thread T0 #0 0x6336b2149129 in size /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/include/llvm/ADT/SmallVector.h:80:32 llvm#1 0x6336b2149129 in operator[] /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/include/llvm/ADT/SmallVector.h:299:5 llvm#2 0x6336b2149129 in populateBoundsForShapedValueDim /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/mlir/lib/Dialect/MemRef/IR/ValueBoundsOpInterfaceImpl.cpp:113:43 ... ``` This patch attempts to fix-forward by stack-allocating reassocIndices, instead of taking a reference to a return value.
#164955 has a use-after-scope (https://lab.llvm.org/buildbot/#/builders/169/builds/16454):
This patch attempts to fix-forward by stack-allocating reassocIndices, instead of taking a reference to a return value.