[Mlir-commits] [mlir] [mlir] Fix correct memset range in `OwningMemRef` zero-init (PR #158200)

Mehdi Amini llvmlistbot at llvm.org
Fri Sep 12 03:25:58 PDT 2025


================
@@ -174,9 +174,7 @@ class OwningMemRef {
            it != end; ++it)
         init(*it, it.getIndices());
     } else {
-      memset(descriptor.data, 0,
-             nElements * sizeof(T) +
-                 alignment.value_or(detail::nextPowerOf2(sizeof(T))));
+      memset(descriptor.data, 0, nElements * sizeof(T));
----------------
joker-eph wrote:

Right, I know this isn't directly causing the bug, but the naming confusion is unfortunate and probably a contributing factor to the existence of the bug in the first place.

You also acknowledged it at the end of the description:

> I think one of the main root causes here is naming. At first, I assumed descriptor.data referred to the raw data pointer—but it doesn’t.

https://github.com/llvm/llvm-project/pull/158200


More information about the Mlir-commits mailing list