Opened 5 years ago

#13285 new Bugs

clang-tidy analyzer complains about uninitialized variable

Reported by: Evgeny Televitckiy <stelek@…> Owned by:
Milestone: To Be Determined Component: process
Version: Boost 1.64.0 Severity: Problem
Keywords: Cc:

Description

Clang tidy complains about uninitialized variable here:

/usr/local/boost-1.64.0/include/boost/process/detail/child_decl.hpp:169:17: error: 1st function call argument is an uninitialized value [clang-analyzer-core.CallAndMessage,-warnings-as-errors]

_exit_status->store(code);

/code/core/source/cpp/private/libs/SensorInterface/Velodyne/tests/PacketDecoderTest.cc:96:13: note: Calling constructor for 'child'

bp::child call_script(bp::search_path("bash"), get_res_script);

/usr/local/boost-1.64.0/include/boost/process/child.hpp:35:13: note: Calling 'execute_impl'

: child(::boost::process::detail::execute_impl(std::forward<Args>(args)...)) {}

/usr/local/boost-1.64.0/include/boost/process/detail/execute_impl.hpp:275:12: note: Calling 'basic_execute_impl'

return basic_execute_impl<req_char_type>(

/usr/local/boost-1.64.0/include/boost/process/detail/execute_impl.hpp:267:12: note: Calling 'executor::operator()'

return exec();

/usr/local/boost-1.64.0/include/boost/process/detail/posix/executor.hpp:312:16: note: Calling 'executor::invoke'

return invoke(has_ignore_error(), shall_use_vfork());

/usr/local/boost-1.64.0/include/boost/process/detail/posix/executor.hpp:371:9: note: Assuming the condition is false

if (::pipe(p) == -1)

/usr/local/boost-1.64.0/include/boost/process/detail/posix/executor.hpp:371:5: note: Taking false branch

if (::pipe(p) == -1)

/usr/local/boost-1.64.0/include/boost/process/detail/posix/executor.hpp:376:9: note: Assuming the condition is false

if (::fcntl(p[1], F_SETFD, FD_CLOEXEC) == -1)

/usr/local/boost-1.64.0/include/boost/process/detail/posix/executor.hpp:376:5: note: Taking false branch

if (::fcntl(p[1], F_SETFD, FD_CLOEXEC) == -1)

/usr/local/boost-1.64.0/include/boost/process/detail/posix/executor.hpp:384:5: note: Taking false branch

if (_ec)

/usr/local/boost-1.64.0/include/boost/process/detail/posix/executor.hpp:391:9: note: Assuming the condition is false

if (pid == -1)

/usr/local/boost-1.64.0/include/boost/process/detail/posix/executor.hpp:391:5: note: Taking false branch

if (pid == -1)

/usr/local/boost-1.64.0/include/boost/process/detail/posix/executor.hpp:400:14: note: Assuming the condition is false

else if (pid == 0)

/usr/local/boost-1.64.0/include/boost/process/detail/posix/executor.hpp:400:10: note: Taking false branch

else if (pid == 0)

/usr/local/boost-1.64.0/include/boost/process/detail/posix/executor.hpp:428:5: note: Taking true branch

if (_ec)

/usr/local/boost-1.64.0/include/boost/process/detail/posix/executor.hpp:431:22: note: Calling '~child'

return child();

/usr/local/boost-1.64.0/include/boost/process/detail/child_decl.hpp:93:13: note: Left side of '&&' is true

if (_attached && !_exited() && running(ec))

/usr/local/boost-1.64.0/include/boost/process/detail/child_decl.hpp:93:13: note: Left side of '&&' is true /usr/local/boost-1.64.0/include/boost/process/detail/child_decl.hpp:93:40: note: Calling 'child::running'

if (_attached && !_exited() && running(ec))

/usr/local/boost-1.64.0/include/boost/process/detail/child_decl.hpp:164:13: note: Left side of '&&' is true

if (valid() && !_exited())

/usr/local/boost-1.64.0/include/boost/process/detail/child_decl.hpp:164:9: note: Taking true branch

if (valid() && !_exited())

/usr/local/boost-1.64.0/include/boost/process/detail/child_decl.hpp:166:13: note: 'code' declared without an initial value

int code;

/usr/local/boost-1.64.0/include/boost/process/detail/child_decl.hpp:167:24: note: Calling 'is_running'

auto res = boost::process::detail::api::is_running(_child_handle, code, ec);

/usr/local/boost-1.64.0/include/boost/process/detail/posix/is_running.hpp:47:9: note: Assuming the condition is true

if (ret == -1)

/usr/local/boost-1.64.0/include/boost/process/detail/posix/is_running.hpp:47:5: note: Taking true branch

if (ret == -1)

/usr/local/boost-1.64.0/include/boost/process/detail/posix/is_running.hpp:49:13: note: Assuming the condition is false

if (errno != ECHILD) because it no child is running, than this one isn't either, obviously.

/usr/include/x86_64-linux-gnu/bits/errno.h:54:18: note: expanded from macro 'errno' # define errno (*errno_location ())

/usr/local/boost-1.64.0/include/boost/process/detail/posix/is_running.hpp:49:9: note: Taking false branch

if (errno != ECHILD) because it no child is running, than this one isn't either, obviously.

/usr/local/boost-1.64.0/include/boost/process/detail/child_decl.hpp:167:24: note: Returning from 'is_running'

auto res = boost::process::detail::api::is_running(_child_handle, code, ec);

/usr/local/boost-1.64.0/include/boost/process/detail/child_decl.hpp:168:17: note: Left side of '&&' is true

if (!res && !_exited())

/usr/local/boost-1.64.0/include/boost/process/detail/child_decl.hpp:168:13: note: Taking true branch

if (!res && !_exited())

/usr/local/boost-1.64.0/include/boost/process/detail/child_decl.hpp:169:17: note: 1st function call argument is an uninitialized value

_exit_status->store(code);

Change History (0)

Note: See TracTickets for help on using tickets.