LindaSummer opened a new pull request, #3172:
URL: https://github.com/apache/kvrocks/pull/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.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]