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

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


The following commit(s) were added to refs/heads/main by this push:
     new 0f45528  fix: Suppress GCC warning for array bounds in String class 
(#439)
0f45528 is described below

commit 0f45528277dd024cd0a9abdeb6dcf1b97ebf8c42
Author: Yichen Yan <[email protected]>
AuthorDate: Sat Feb 14 04:36:52 2026 +0800

    fix: Suppress GCC warning for array bounds in String class (#439)
    
    ```
      In file included from 
/project/3rdparty/tvm/3rdparty/tvm-ffi/include/tvm/ffi/any.h:27,
                       from 
/project/3rdparty/tvm/3rdparty/tvm-ffi/include/tvm/ffi/reflection/registry.h:26,
                       from 
/project/3rdparty/tvm/src/relax/transform/meta_schedule.cc:24:
      In static member function ‘static tvm::ffi::String 
tvm::ffi::String::Concat(const char*, size_t, const char*, size_t)’,
          inlined from ‘tvm::ffi::String tvm::ffi::operator+(const String&, 
const char*)’ at 
/project/3rdparty/tvm/3rdparty/tvm-ffi/include/tvm/ffi/string.h:972:60,
          inlined from 
‘tvm::relax::transform::MetaScheduleApplyDatabase(tvm::ffi::Optional<tvm::ffi::String>,
 bool)::<lambda(tvm::IRModule, tvm::relax::transform::PassContext)>’ at 
/project/3rdparty/tvm/src/relax/transform/meta_schedule.cc:90:54:
      /project/3rdparty/tvm/3rdparty/tvm-ffi/include/tvm/ffi/string.h:669:16: 
warning: ‘void* memcpy(void*, const void*, size_t)’ offset [-15, -8] is out of 
the bounds [0, 16] of object ‘path_workload’ with type ‘tvm::ffi::String’ 
[-Warray-bounds=]
        669 |     std::memcpy(dest_data + lhs_size, rhs, rhs_size);
            |     ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      /project/3rdparty/tvm/src/relax/transform/meta_schedule.cc: In function 
‘tvm::relax::transform::MetaScheduleApplyDatabase(tvm::ffi::Optional<tvm::ffi::String>,
 bool)::<lambda(tvm::IRModule, tvm::relax::transform::PassContext)>’:
      /project/3rdparty/tvm/src/relax/transform/meta_schedule.cc:90:19: note: 
‘path_workload’ declared here
         90 |       ffi::String path_workload = work_dir.value() + 
"/database_workload.json";
            |                   ^~~~~~~~~~~~~
    ```
---
 include/tvm/ffi/string.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/tvm/ffi/string.h b/include/tvm/ffi/string.h
index 0c885e9..3a3ffcd 100644
--- a/include/tvm/ffi/string.h
+++ b/include/tvm/ffi/string.h
@@ -780,6 +780,7 @@ class String {
 #if (__GNUC__) && !(__clang__)
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wstringop-overflow"
+#pragma GCC diagnostic ignored "-Warray-bounds"
 #pragma GCC diagnostic ignored "-Wrestrict"
 #endif
     char* dest_data = ret.InitSpaceForSize(lhs_size + rhs_size);

Reply via email to