Repository navigation
Patch ros2-rclcpp to avoid GCC 15 -Werror=uninitialized in MessageMemoryStrategy::create_default() - #254
Conversation
ABI check (linux-64)humble linux-64: 1 to review (changed headers), 4 can be bumped on their own
4 packages can be bumped on their own (compatible: 2, no libraries: 2)
Compared with the newest builds on https://conda.anaconda.org/robostack-humble/linux-64. jazzy linux-64: 1 to review (changed headers), 6 can be bumped on their own
6 packages can be bumped on their own (compatible: 2, no libraries: 4)
Compared with the newest builds on https://conda.anaconda.org/robostack-jazzy/linux-64. lyrical linux-64: 1 to review (changed headers), 6 can be bumped on their own
6 packages can be bumped on their own (compatible: 2, no libraries: 4)
Compared with the newest builds on https://repo.prefix.dev/robostack-lyrical/linux-64. rolling linux-64: 1 to review (changed headers), 5 can be bumped on their own
5 packages can be bumped on their own (compatible: 1, no libraries: 4)
Compared with the newest builds on https://repo.prefix.dev/robostack-rolling/linux-64. About this checkEach package this pull request built, compared with its newest released build (
Exported symbols are compared (the released packages are stripped, so struct layouts aren't); unchanged installed headers rule out layout and inline changes, changed ones are listed for review. Dependents to rebuild are the released ones linking to a changed library. A changed pin is part of the comparison. |
|
Why only in Jazzy? Can you also contribute this upstream? Thanks! |
I only tested in Jazzy. I can look to put this in all distros and look to contribute upstream. |
…s all distros Avoid unnecessary std::make_shared<std::allocator<void>>() in MessageMemoryStrategy::create_default(), which triggers a GCC 15 -Werror=uninitialized false positive in downstream packages. - Place ros2-rclcpp.patch in shared/patch/ (covering humble, jazzy, rolling) - Add matching distros/lyrical/patch/ros2-rclcpp.patch alongside its existing ros2-rclcpp.win.patch (distro patches override shared patches) - Bump rclcpp build_number in humble (26), jazzy (32), lyrical (31), and rolling (33)
d255310 to
ab22445
Compare
|
Here is the upstream PR: ros2/rclcpp#3436 |
|
Are we good to merge @traversaro? |
Summary
In
rclcpp::message_memory_strategy::MessageMemoryStrategy::create_default(), avoid heap-allocating a temporarystd::shared_ptr<std::allocator<void>>whenAllocis the defaultstd::allocator<void>, and call the existing 0-argMessageMemoryStrategy()constructor directly instead.Motivation
create_subscription()/MessageMemoryStrategy::create_default()call: currentlystd::make_shared<Alloc>()allocates a control block + emptystd::allocator<void>, passes it toMessageMemoryStrategy(std::shared_ptr<Alloc>), which dereferences it and immediately destroys the temporaryshared_ptr.-Werror=uninitializedfailure in downstream C++ code compiled with-O2 -Wall -Wextra -Werror: in constructors with manycreate_subscription()calls, GCC 15.3.0's SRA pass emits a false-positive-Wuninitializedwarning on the scalarized emptystd::allocator<void>insidestd::make_shared<std::allocator<void>>():Implementation Details
if constexpr (std::is_same_v<Alloc, std::allocator<void>>)— matching the exact pattern already used in bothMessageMemoryStrategyconstructors directly abovecreate_default().Alloctypes (which still share a single default-constructedAllocinstance acrossmessage_allocator_,serialized_message_allocator_, andbuffer_allocator_).Testing The Patch
pixi run rs jazzy generate-recipes: Generated ros2-rclcpp (and legacy ros-jazzy-rclcpp) at build_number: 32. pixi run rs jazzy check-patches --recipe ros2-rclcpp: Passed (1/1) — All patches applied cleanly. across all platforms (linux, osx, win, emscripten). pixi run rs check: # check: ok — all distributions assemble, YAML sorting and generated files are up to date.