Skip to content

🧑‍🌾 Warning in Jazzy ci connext regarding uninitialized variables in GenericClient (status_offset, result_offset) #3128

@miguelgonrod

Description

@miguelgonrod

Generated by Generative AI

No response

Operating System:

Ubuntu noble

ROS version or commit hash:

Jazzy

RMW implementation (if applicable):

connext

RMW Configuration (if applicable):

No response

Client library (if applicable):

rclcpp

'ros2 doctor --report' output

Steps to reproduce issue

  1. Go to https://build.ros2.org/job/Jci__nightly-connext_ubuntu_noble_amd64
  2. Build a job
  3. See the warning

Expected behavior

To build without warnings

Actual behavior

Building with warnings

Additional information

Reference Builds

https://build.ros2.org/job/Jci__nightly-connext_ubuntu_noble_amd64/256/
Log Output
--- stderr: rclcpp_action
In lambda function,
    inlined from ‘constexpr _Res std::__invoke_impl(__invoke_other, _Fn&&, _Args&& ...) [with _Res = void; _Fn = rclcpp_action::GenericClient::make_result_aware(rclcpp_action::GenericClientGoalHandle::SharedPtr)::<lambda(shared_ptr<void>)>&; _Args = {shared_ptr<void>}]’ at /usr/include/c++/13/bits/invoke.h:61:36,
    inlined from ‘constexpr std::enable_if_t<is_invocable_r_v<_Res, _Callable, _Args ...>, _Res> std::__invoke_r(_Callable&&, _Args&& ...) [with _Res = void; _Callable = rclcpp_action::GenericClient::make_result_aware(rclcpp_action::GenericClientGoalHandle::SharedPtr)::<lambda(shared_ptr<void>)>&; _Args = {shared_ptr<void>}]’ at /usr/include/c++/13/bits/invoke.h:111:28,
    inlined from ‘static _Res std::_Function_handler<_Res(_ArgTypes ...), _Functor>::_M_invoke(const std::_Any_data&, _ArgTypes&& ...) [with _Res = void; _Functor = rclcpp_action::GenericClient::make_result_aware(rclcpp_action::GenericClientGoalHandle::SharedPtr)::<lambda(std::shared_ptr<void>)>; _ArgTypes = {std::shared_ptr<void>}]’ at /usr/include/c++/13/bits/std_function.h:290:30:
/tmp/ws/src/ros2/rclcpp/rclcpp_action/src/generic_client.cpp:440:20: warning: ‘status_offset’ may be used uninitialized [-Wmaybe-uninitialized]
  440 |         std::memcpy(
      |         ~~~~~~~~~~~^
  441 |           static_cast<void *>(&wrapped_result.code),
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  442 |           static_cast<void *>(reinterpret_cast<char *>(response.get()) + status_offset),
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  443 |           sizeof(int8_t));  // ROS_TYPE_INT8
      |           ~~~~~~~~~~~~~~~
/tmp/ws/src/ros2/rclcpp/rclcpp_action/src/generic_client.cpp: In static member function ‘static _Res std::_Function_handler<_Res(_ArgTypes ...), _Functor>::_M_invoke(const std::_Any_data&, _ArgTypes&& ...) [with _Res = void; _Functor = rclcpp_action::GenericClient::make_result_aware(rclcpp_action::GenericClientGoalHandle::SharedPtr)::<lambda(std::shared_ptr<void>)>; _ArgTypes = {std::shared_ptr<void>}]’:
/tmp/ws/src/ros2/rclcpp/rclcpp_action/src/generic_client.cpp:423:16: note: ‘status_offset’ was declared here
  423 |         size_t status_offset;
      |                ^~~~~~~~~~~~~
In lambda function,
    inlined from ‘constexpr _Res std::__invoke_impl(__invoke_other, _Fn&&, _Args&& ...) [with _Res = void; _Fn = rclcpp_action::GenericClient::make_result_aware(rclcpp_action::GenericClientGoalHandle::SharedPtr)::<lambda(shared_ptr<void>)>&; _Args = {shared_ptr<void>}]’ at /usr/include/c++/13/bits/invoke.h:61:36,
    inlined from ‘constexpr std::enable_if_t<is_invocable_r_v<_Res, _Callable, _Args ...>, _Res> std::__invoke_r(_Callable&&, _Args&& ...) [with _Res = void; _Callable = rclcpp_action::GenericClient::make_result_aware(rclcpp_action::GenericClientGoalHandle::SharedPtr)::<lambda(shared_ptr<void>)>&; _Args = {shared_ptr<void>}]’ at /usr/include/c++/13/bits/invoke.h:111:28,
    inlined from ‘static _Res std::_Function_handler<_Res(_ArgTypes ...), _Functor>::_M_invoke(const std::_Any_data&, _ArgTypes&& ...) [with _Res = void; _Functor = rclcpp_action::GenericClient::make_result_aware(rclcpp_action::GenericClientGoalHandle::SharedPtr)::<lambda(std::shared_ptr<void>)>; _ArgTypes = {std::shared_ptr<void>}]’ at /usr/include/c++/13/bits/std_function.h:290:30:
/tmp/ws/src/ros2/rclcpp/rclcpp_action/src/generic_client.cpp:438:74: warning: ‘result_offset’ may be used uninitialized [-Wmaybe-uninitialized]
  438 |         wrapped_result.result = reinterpret_cast<char *>(response.get()) + result_offset;
      |                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
/tmp/ws/src/ros2/rclcpp/rclcpp_action/src/generic_client.cpp: In static member function ‘static _Res std::_Function_handler<_Res(_ArgTypes ...), _Functor>::_M_invoke(const std::_Any_data&, _ArgTypes&& ...) [with _Res = void; _Functor = rclcpp_action::GenericClient::make_result_aware(rclcpp_action::GenericClientGoalHandle::SharedPtr)::<lambda(std::shared_ptr<void>)>; _ArgTypes = {std::shared_ptr<void>}]’:
/tmp/ws/src/ros2/rclcpp/rclcpp_action/src/generic_client.cpp:424:16: note: ‘result_offset’ was declared here
  424 |         size_t result_offset;
      |                ^~~~~~~~~~~~~
---

Changes show this:

   ros2/rclcpp:
     type: git
     url: https://github.com/ros2/rclcpp.git
-    version: 8564e013a435d7eae79cfa8923a0d75f9e4a27ad
+    version: 6f96da6f99d7f5718ee1d173670d524e85a8e003

Maybe in this one was the breaking change https://github.com/ros2/rclcpp/commit/6f96da6f99d7f5718ee1d173670d524e85a8e003 but being honest I'm not sure

CC: @Crola1702

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions