This is an automated email from the ASF dual-hosted git repository.

cbalint13 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git


The following commit(s) were added to refs/heads/main by this push:
     new 71f1ad03d5 [Fix][Relax] Fix dangling reference in GetTargetFunctions() 
(#17950)
71f1ad03d5 is described below

commit 71f1ad03d5263e84d1df8adf60cac7f790634dec
Author: Phoslight <[email protected]>
AuthorDate: Tue May 13 02:14:14 2025 -0700

    [Fix][Relax] Fix dangling reference in GetTargetFunctions() (#17950)
    
    This patch fixes a dangling reference issue that can be reproduced locally 
on macOS.
---
 src/relax/transform/lift_transform_params.cc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/relax/transform/lift_transform_params.cc 
b/src/relax/transform/lift_transform_params.cc
index 180c0be891..df7242efd4 100644
--- a/src/relax/transform/lift_transform_params.cc
+++ b/src/relax/transform/lift_transform_params.cc
@@ -703,7 +703,8 @@ std::vector<std::pair<GlobalVar, Function>> 
GetTargetFunctions(
     const IRModule& mod, const Variant<Bool, Array<String>>& shared_transform) 
{
   std::vector<std::pair<GlobalVar, Function>> target_functions;
   if (shared_transform.as<Array<String>>().value_or(Array<String>{}).size()) {
-    for (const auto& name : shared_transform.as<Array<String>>().value()) {
+    auto names = shared_transform.as<Array<String>>().value();
+    for (const auto& name : names) {
       auto gvar = mod->global_var_map_.Get(name);
       CHECK(gvar) << "When LiftTransformParams is called with a list of 
function names, "
                   << "all function names must occur within the IRModule.  "

Reply via email to