boostorg / boostorg/boost

Build fails when "--analyze" is enabled in gcc and clang.

Open
#1,011 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
HTML
Stars
8.6k
Forks
1.9k
Avg merge
39m
Merged PRs (30d)
2

Description

When I enable "--analyze" in gcc or clang, the build fails.
In this case, should I change the source code I'm using? Should I apply a patch to the library?

~~~
In function ‘boost::fibers::stack_allocator_wrapper boost::fibers::make_stack_allocator_wrapper(Args&& ...) [with StackAllocator = boost::context::basic_fixedsize_stack; Args = {}]’:
cc1plus: error: use of possibly-NULL ‘operator new(16)’ where non-null expected [CWE-690] [-Werror=analyzer-possible-null-argument]
‘boost::fibers::stack_allocator_wrapper boost::fibers::make_stack_allocator_wrapper(Args&& ...) [with StackAllocator = boost::context::basic_fixedsize_stack; Args = {}]’: event 1
|
|/include/boost/fiber/stack_allocator_wrapper.hpp:89:17:
| 89 | new detail::polymorphic_stack_allocator_impl(std::forward< Args >( args) ... )));
| | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| | |
| | (1) this call could return NULL
|
‘boost::fibers::stack_allocator_wrapper boost::fibers::make_stack_allocator_wrapper(Args&& ...) [with StackAllocator = boost::context::basic_fixedsize_stack; Args = {}]’: event 2
|
|cc1plus:
| (2): argument 'this' (‘operator new(16)’) from (1) could be NULL where non-null expected
|

note: argument 'this' of ‘boost::fibers::detail::polymorphic_stack_allocator_impl::polymorphic_stack_allocator_impl(Args&& ...) [with Args = {}; StackAllocator = boost::context::basic_fixedsize_stack]’ must be non-null
35 | polymorphic_stack_allocator_impl( Args && ... args )
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~

Contributor guide

No contributing guide indexed for this repository

Research direction

The reported location is include/boost/fiber/stack_allocator_wrapper.hpp:89, with constructor context at line 35. Reproduce the build with --analyze under GCC and Clang, then inspect the allocation call and determine whether the warning reflects a library defect or analyzer behavior. Done means the affected build has a documented, verified resolution.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.