[Mlir-commits] [mlir] [MLIR] Fix array-vs-singleton pattern flagged by Coverity in generated code (PR #215217)

Mehdi Amini llvmlistbot at llvm.org
Mon Aug 17 03:35:05 PDT 2026


================
@@ -39,7 +39,7 @@ template<typename Fn> class function_ref;
 template <typename Ret, typename... Params>
 class LLVM_GSL_POINTER function_ref<Ret(Params...)> {
   Ret (*callback)(intptr_t callable, Params ...params) = nullptr;
-  intptr_t callable;
+  intptr_t callable = 0;
----------------
joker-eph wrote:

When you say "real defect": can you clarify the path to failure: how is this used without being set in our codebase?
>From what I can see from the class invariant, this will be left unset only when `callback` is nullptr. And only `callback` is used for the checks in this class.

Maybe copying a default-constructed (or nullptr constructed) `function_ref` would read this?

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


More information about the Mlir-commits mailing list