boostorg / boostorg/multi_index

Null pointer dereference warning

Open
#93 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
58
Forks
65
Avg merge
3h 1m
Merged PRs (30d)
1

Description

GCC, `-Wnull-dereference`, `-O1` or higher.

https://godbolt.org/z/TvWaEbvja
```cpp
#include
#include
#include

int main()
{
using namespace boost::multi_index;
multi_index_container<
int,
indexed_by<
ordered_unique>
>
> c;
c.insert(0);
c.insert(1);

return 0;
}
```

```
In file included from /cefs/22/22e6cdc013c8541ce3d1548e_consolidated/compilers_c++_x86_gcc_15.2.0/include/c++/15.2.0/functional:51,
from /app/boost/include/boost/multi_index/detail/ord_index_args.hpp:24,
from /app/boost/include/boost/multi_index/ordered_index_fwd.hpp:16,
from /app/boost/include/boost/multi_index_container_fwd.hpp:19,
from /app/boost/include/boost/multi_index_container.hpp:32,
from :1:
In member function 'constexpr bool std::less<_Tp>::operator()(const _Tp&, const _Tp&) const [with _Tp = int]',
inlined from 'bool boost::multi_index::detail::ordered_index_impl::link_point(key_param_type, link_info&, boost::multi_index::detail::ordered_unique_tag) [with KeyFromValue = boost::multi_index::identity; Compare = std::less; SuperMeta = boost::multi_index::detail::nth_layer<1, int, boost::multi_index::indexed_by > >, std::allocator >; TagList = boost::mpl::vector0; Category = boost::multi_index::detail::ordered_unique_tag; AugmentPolicy = boost::multi_index::detail::null_augment_policy]' at /app/boost/include/boost/multi_index/detail/ord_index_impl.hpp:1179:13,
inlined from 'boost::multi_index::detail::ordered_index_impl::final_node_type* boost::multi_index::detail::ordered_index_impl::insert_(value_param_type, final_node_type*&, Variant) [with Variant = boost::multi_index::detail::rvalue_tag; KeyFromValue = boost::multi_index::identity; Compare = std::less; SuperMeta = boost::multi_index::detail::nth_layer<1, int, boost::multi_index::indexed_by > >, std::allocator >; TagList = boost::mpl::vector0; Category = boost::multi_index::detail::ordered_unique_tag; AugmentPolicy = boost::multi_index::detail::null_augment_policy]' at /app/boost/include/boost/multi_index/detail/ord_index_impl.hpp:847:19,
inlined from 'std::pair::type::final_node_type*, bool> boost::multi_index::multi_index_container::insert_(const Value&, Variant) [with Variant = boost::multi_index::detail::rvalue_tag; Value = int; IndexSpecifierList = boost::multi_index::indexed_by > >; Allocator = std::allocator]' at /app/boost/include/boost/multi_index_container.hpp:694:40,
inlined from 'std::pair::type::final_node_type*, bool> boost::multi_index::multi_index_container::insert_rv_(const Value&) [with Value = int; IndexSpecifierList = boost::multi_index::indexed_by > >; Allocator = std::allocator]' at /app/boost/include/boost/multi_index_container.hpp:711:19,
inlined from 'std::pair::type*, bool> boost::multi_index::detail::index_base::final_insert_rv_(const value_type&) [with Value = int; IndexSpecifierList = boost::multi_index::indexed_by > >; Allocator = std::allocator]' at /app/boost/include/boost/multi_index/detail/index_base.hpp:230:31,
inlined from 'std::pair >, bool> boost::multi_index::detail::ordered_index_impl::insert(value_type&&) [with KeyFromValue = boost::multi_index::identity; Compare = std::less; SuperMeta = boost::multi_index::detail::nth_layer<1, int, boost::multi_index::indexed_by > >, std::allocator >; TagList = boost::mpl::vector0; Category = boost::multi_index::detail::ordered_unique_tag; AugmentPolicy = boost::multi_index::detail::null_augment_policy]' at /app/boost/include/boost/multi_index/detail/ord_index_impl.hpp:316:62:
/cefs/22/22e6cdc013c8541ce3d1548e_consolidated/compilers_c++_x86_gcc_15.2.0/include/c++/15.2.0/bits/stl_function.h:405:20: error: potential null pointer dereference [-Werror=null-dereference]
405 | { return __x < __y; }
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.