Skip to content

[C++] "may be used uninitialized" build error with gcc 16 in acero test utils #51278

Description

@adamreeve

I get the following error building Arrow C++ with gcc 16.2.1 on x86_64 Fedora Linux 44, using the ninja-debug-python CMake preset:

/home/adam/dev/arrow/cpp/src/arrow/acero/test_util_internal.cc: In constructor ‘arrow::acero::{anonymous}::DummyNode::DummyNode(arrow::acero::ExecPlan*, arrow::acero::ExecNode::NodeVector, bool, arrow::acero::StartProducingFunc, arrow::acero::StopProducingFunc)’:
/home/adam/dev/arrow/cpp/src/arrow/acero/test_util_internal.cc:79:57: error: ‘<unknown>’ may be used uninitialized [-Werror=maybe-uninitialized]
   79 |       : ExecNode(plan, std::move(inputs), {}, (is_sink) ? nullptr : dummy_schema()),
      |                                               ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
/home/adam/dev/arrow/cpp/src/arrow/acero/test_util_internal.cc:124:27: note: by argument 1 of type ‘const arrow::acero::{anonymous}::DummyNode*’ to ‘std::shared_ptr<arrow::Schema> arrow::acero::{anonymous}::DummyNode::dummy_schema() const’ declared here
  124 |   std::shared_ptr<Schema> dummy_schema() const {
      |                           ^~~~~~~~~~~~
cc1plus: all warnings being treated as errors

dummy_schema() is a method of DummyNode but the DummyNode instance is not yet initialized when this is called.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions