Describe the bug
The following build error occurred when building for i386 on Debian with GCC 15.2.0:
[3/147] /usr/lib/ccache/c++ -I/build/package/package/include -I/build/package/package/test -I/build/package/package/test/thirdparty -I/build/package/package/test/thirdparty/catch -g -O2 -ffile-prefix-map=/build/package/package=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -Werror=maybe-uninitialized -Wnon-virtual-dtor -Werror=stringop-overflow -Werror -Wall -Wextra -Wcast-align -Wcast-qual -Wimplicit-fallthrough -Wsign-compare -pedantic -Wnonnull -Wnull-dereference -Werror=nonnull -MD -MT test/CMakeFiles/unit_tests.dir/bson/src/bson_cursor_tests.cpp.o -MF test/CMakeFiles/unit_tests.dir/bson/src/bson_cursor_tests.cpp.o.d -o test/CMakeFiles/unit_tests.dir/bson/src/bson_cursor_tests.cpp.o -c /build/package/package/test/bson/src/bson_cursor_tests.cpp
FAILED: test/CMakeFiles/unit_tests.dir/bson/src/bson_cursor_tests.cpp.o
/usr/lib/ccache/c++ -I/build/package/package/include -I/build/package/package/test -I/build/package/package/test/thirdparty -I/build/package/package/test/thirdparty/catch -g -O2 -ffile-prefix-map=/build/package/package=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -Werror=maybe-uninitialized -Wnon-virtual-dtor -Werror=stringop-overflow -Werror -Wall -Wextra -Wcast-align -Wcast-qual -Wimplicit-fallthrough -Wsign-compare -pedantic -Wnonnull -Wnull-dereference -Werror=nonnull -MD -MT test/CMakeFiles/unit_tests.dir/bson/src/bson_cursor_tests.cpp.o -MF test/CMakeFiles/unit_tests.dir/bson/src/bson_cursor_tests.cpp.o.d -o test/CMakeFiles/unit_tests.dir/bson/src/bson_cursor_tests.cpp.o -c /build/package/package/test/bson/src/bson_cursor_tests.cpp
In file included from /usr/include/i386-linux-gnu/c++/15/bits/c++allocator.h:33,
from /usr/include/c++/15/bits/allocator.h:46,
from /usr/include/c++/15/bits/alloc_traits.h:39,
from /usr/include/c++/15/ext/alloc_traits.h:36,
from /usr/include/c++/15/bits/hashtable_policy.h:39,
from /usr/include/c++/15/bits/hashtable.h:37,
from /usr/include/c++/15/bits/unordered_map.h:33,
from /usr/include/c++/15/unordered_map:43,
from /usr/include/c++/15/functional:65,
from /build/package/package/include/jsoncons_ext/bson/bson_cursor.hpp:11,
from /build/package/package/test/bson/src/bson_cursor_tests.cpp:8:
In member function ‘void std::__new_allocator<_Tp>::deallocate(_Tp*, size_type) [with _Tp = long long unsigned int]’,
inlined from ‘static void std::allocator_traits<std::allocator<_Tp1> >::deallocate(allocator_type&, pointer, size_type) [with _Tp = long long unsigned int]’ at /usr/include/c++/15/bits/alloc_traits.h:649:23,
inlined from ‘void jsoncons::basic_bigint<Allocator>::dynamic_storage::destroy(const real_allocator_type&) [with Allocator = std::allocator<unsigned char>]’ at /build/package/package/include/jsoncons/utility/bigint.hpp:275:71,
inlined from ‘void jsoncons::basic_bigint<Allocator>::destroy() [with Allocator = std::allocator<unsigned char>]’ at /build/package/package/include/jsoncons/utility/bigint.hpp:1545:34,
inlined from ‘jsoncons::basic_bigint<Allocator>::~basic_bigint() [with Allocator = std::allocator<unsigned char>]’ at /build/package/package/include/jsoncons/utility/bigint.hpp:359:16,
inlined from ‘void jsoncons::basic_bigint<Allocator>::unnormalize(jsoncons::basic_bigint<Allocator>&, int, int) const [with Allocator = std::allocator<unsigned char>]’ at /build/package/package/include/jsoncons/utility/bigint.hpp:1668:20,
inlined from ‘void jsoncons::basic_bigint<Allocator>::divide(jsoncons::basic_bigint<Allocator>, jsoncons::basic_bigint<Allocator>&, jsoncons::basic_bigint<Allocator>&, bool) const [with Allocator = std::allocator<unsigned char>]’ at /build/package/package/include/jsoncons/utility/bigint.hpp:1536:24:
/usr/include/c++/15/bits/new_allocator.h:172:66: error: ‘void operator delete(void*, std::size_t)’ called on a pointer to an unallocated object ‘4294967295’ [-Werror=free-nonheap-object]
172 | _GLIBCXX_OPERATOR_DELETE(_GLIBCXX_SIZED_DEALLOC(__p, __n));
| ^
cc1plus: all warnings being treated as errors
Looks like there is a delete operator called on address -1 (which equals UINT32_MAX, i.e. 4294967295). I tried to read the code from bigint.hpp, but have not discovered anything obvious. Please investigate whether there is an architecture-related issue.
The full log could be obtained here.
Enumerate the steps to reproduce the bug
Just build with the specified configuration.
What compiler, architecture, and operating system?
- Compiler: GCC 15.2.0
- Architecture: i386
- Operating system: Debian sid
What jsoncons library version?
Describe the bug
The following build error occurred when building for i386 on Debian with GCC 15.2.0:
Looks like there is a
deleteoperator called on address -1 (which equalsUINT32_MAX, i.e. 4294967295). I tried to read the code frombigint.hpp, but have not discovered anything obvious. Please investigate whether there is an architecture-related issue.The full log could be obtained here.
Enumerate the steps to reproduce the bug
Just build with the specified configuration.
What compiler, architecture, and operating system?
What jsoncons library version?