The GitHub Actions job "CI" on kvrocks.git/unstable has failed.
Run started by GitHub user PragmaTwice (triggered by PragmaTwice).

Head commit for run:
5f0479b2071d16eebbba378e857f1efca6472cd4 / Edward Xu <[email protected]>
fix: gcc15 compiler warning `free-nonheap-object` in `cmd_search.cc` (#3172)

# Issue

fix #3165

# Root cause

This root cause is a new feature in gcc15.2 `free-nonheap-object`.

Here is the error message. It's in link stage.
IMHO it makes me confused at the first time I saw errors like this.

```
[5/7] Linking CXX executable kvrocks
In member function 'deallocate',
    inlined from 'deallocate' at 
/usr/local/include/c++/15.2.0/bits/alloc_traits.h:649:23,
    inlined from '_M_destroy' at 
/usr/local/include/c++/15.2.0/bits/basic_string.h:305:34,
    inlined from '_M_dispose' at 
/usr/local/include/c++/15.2.0/bits/basic_string.h:299:14,
    inlined from '__dt_base ' at 
/usr/local/include/c++/15.2.0/bits/basic_string.h:896:19,
    inlined from '__dt_base ' at /build/src/common/status.h:170:3,
    inlined from '__dt_base ' at /build/src/common/status.h:362:23,
    inlined from 'Execute' at /build/src/commands/cmd_search.cc:543:25:
/usr/local/include/c++/15.2.0/bits/new_allocator.h:172:66: warning: 'operator 
delete' called on unallocated object '<anonymous>' [-Wfree-nonheap-object]
  172 |         _GLIBCXX_OPERATOR_DELETE(_GLIBCXX_SIZED_DEALLOC(__p, __n));
      |                                                                  ^
/build/src/commands/cmd_search.cc: In member function 'Execute':
/build/src/commands/cmd_search.cc:543:25: note: declared here
  543 |     auto field_values = GET_OR_RET(srv->index_mgr.TagValues(ctx, 
index_name, tag_field_name, conn->GetNamespace()));
      |                         ^
In member function 'deallocate',
    inlined from 'deallocate' at 
/usr/local/include/c++/15.2.0/bits/alloc_traits.h:649:23,
    inlined from '_M_destroy' at 
/usr/local/include/c++/15.2.0/bits/basic_string.h:305:34,
    inlined from '_M_dispose' at 
/usr/local/include/c++/15.2.0/bits/basic_string.h:299:14,
    inlined from '__dt_base ' at 
/usr/local/include/c++/15.2.0/bits/basic_string.h:896:19,
    inlined from '__dt_base ' at /build/src/common/status.h:170:3,
    inlined from '__dt_base ' at /build/src/common/status.h:362:23,
    inlined from 'Execute' at /build/src/commands/cmd_search.cc:543:25:
/usr/local/include/c++/15.2.0/bits/new_allocator.h:172:66: warning: 'operator 
delete' called on unallocated object '<anonymous>' [-Wfree-nonheap-object]
  172 |         _GLIBCXX_OPERATOR_DELETE(_GLIBCXX_SIZED_DEALLOC(__p, __n));
      |                                                                  ^
/build/src/commands/cmd_search.cc: In member function 'Execute':
/build/src/commands/cmd_search.cc:543:25: note: declared here
  543 |     auto field_values = GET_OR_RET(srv->index_mgr.TagValues(ctx, 
index_name, tag_field_name, conn->GetNamespace()));
      |                         ^
[6/7] Linking CXX executable kvrocks2redis
In member function 'deallocate',
    inlined from 'deallocate' at 
/usr/local/include/c++/15.2.0/bits/alloc_traits.h:649:23,
    inlined from '_M_destroy' at 
/usr/local/include/c++/15.2.0/bits/basic_string.h:305:34,
    inlined from '_M_dispose' at 
/usr/local/include/c++/15.2.0/bits/basic_string.h:299:14,
    inlined from '__dt_base ' at 
/usr/local/include/c++/15.2.0/bits/basic_string.h:896:19,
    inlined from '__dt_base ' at /build/src/common/status.h:170:3,
    inlined from '__dt_base ' at /build/src/common/status.h:362:23,
    inlined from 'Execute' at /build/src/commands/cmd_search.cc:543:25:
/usr/local/include/c++/15.2.0/bits/new_allocator.h:172:66: warning: 'operator 
delete' called on unallocated object '<anonymous>' [-Wfree-nonheap-object]
  172 |         _GLIBCXX_OPERATOR_DELETE(_GLIBCXX_SIZED_DEALLOC(__p, __n));
      |                                                                  ^
/build/src/commands/cmd_search.cc: In member function 'Execute':
/build/src/commands/cmd_search.cc:543:25: note: declared here
  543 |     auto field_values = GET_OR_RET(srv->index_mgr.TagValues(ctx, 
index_name, tag_field_name, conn->GetNamespace()));
      |                         ^
In member function 'deallocate',
    inlined from 'deallocate' at 
/usr/local/include/c++/15.2.0/bits/alloc_traits.h:649:23,
    inlined from '_M_destroy' at 
/usr/local/include/c++/15.2.0/bits/basic_string.h:305:34,
    inlined from '_M_dispose' at 
/usr/local/include/c++/15.2.0/bits/basic_string.h:299:14,
    inlined from '__dt_base ' at 
/usr/local/include/c++/15.2.0/bits/basic_string.h:896:19,
    inlined from '__dt_base ' at /build/src/common/status.h:170:3,
    inlined from '__dt_base ' at /build/src/common/status.h:362:23,
    inlined from 'Execute' at /build/src/commands/cmd_search.cc:543:25:
/usr/local/include/c++/15.2.0/bits/new_allocator.h:172:66: warning: 'operator 
delete' called on unallocated object '<anonymous>' [-Wfree-nonheap-object]
  172 |         _GLIBCXX_OPERATOR_DELETE(_GLIBCXX_SIZED_DEALLOC(__p, __n));
      |                                                                  ^
/build/src/commands/cmd_search.cc: In member function 'Execute':
/build/src/commands/cmd_search.cc:543:25: note: declared here
  543 |     auto field_values = GET_OR_RET(srv->index_mgr.TagValues(ctx, 
index_name, tag_field_name, conn->GetNamespace()));
      | 
```

If I understand correctly, it should caused by the dtor of `Status`.


https://github.com/apache/kvrocks/blob/dfdd2105df3b206e95accea217d50d70dbbee220/src/common/status.h#L358-L364

# Proposed Changes

Mitigate this problem by implicitly checking the status without the
`GET_OR_RET` macro.

---------

Co-authored-by: Twice <[email protected]>

Report URL: https://github.com/apache/kvrocks/actions/runs/18193380043

With regards,
GitHub Actions via GitBox

Reply via email to