Keith Kraus created ARROW-13601:
-----------------------------------

             Summary: [C++] Tests maybe uninitialized compiler warnings
                 Key: ARROW-13601
                 URL: https://issues.apache.org/jira/browse/ARROW-13601
             Project: Apache Arrow
          Issue Type: Bug
          Components: C++
            Reporter: Keith Kraus


Using gcc9 I get the following:

{code}
/home/keith/git/arrow/cpp/src/arrow/testing/json_internal.cc: In function 
'arrow::Status arrow::testing::json::{anonymous}::GetField(const Value&, 
arrow::ipc::internal::FieldPosition, arrow::ipc::DictionaryMemo*, 
std::shared_ptr<arrow::Field>*)':
/home/keith/git/arrow/cpp/src/arrow/testing/json_internal.cc:1128:31: warning: 
'is_ordered' may be used uninitialized in this function [-Wmaybe-uninitialized]
 1128 |     type = ::arrow::dictionary(index_type, type, is_ordered);
      |            ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
{code}

{code}
In file included from 
/home/keith/git/arrow/cpp/src/arrow/util/bit_run_reader.h:26,
                 from 
/home/keith/git/arrow/cpp/src/arrow/util/bit_util_test.cc:45:
/home/keith/git/arrow/cpp/src/arrow/util/bitmap_reader.h: In member function 
'void arrow::TestBitmapUInt64Reader::AssertWords(const arrow::Buffer&, int64_t, 
int64_t, const std::vector<long unsigned int>&)':
/home/keith/git/arrow/cpp/src/arrow/util/bitmap_reader.h:99:16: warning: 
'reader.arrow::internal::BitmapUInt64Reader::carry_bits_' may be used 
uninitialized in this function [-Wmaybe-uninitialized]
   99 |       uint64_t word = carry_bits_ | (next_word << num_carry_bits_);
      |                ^~~~
/home/keith/git/arrow/cpp/src/arrow/util/bit_util_test.cc:242:34: note: 
'reader.arrow::internal::BitmapUInt64Reader::carry_bits_' was declared here
  242 |     internal::BitmapUInt64Reader reader(buffer.data(), start_offset, 
length);
{code}

{code}
In file included from 
/home/keith/git/arrow/cpp/src/arrow/util/async_generator.h:30,
                 from 
/home/keith/git/arrow/cpp/src/arrow/util/iterator_test.cc:30:
/home/keith/git/arrow/cpp/src/arrow/util/iterator.h: In member function 
'arrow::Result<Control> arrow::TransformIterator<T, V>::Next() [with T = 
std::shared_ptr<int>; V = std::shared_ptr<int>]':
/home/keith/git/arrow/cpp/src/arrow/util/iterator.h:288:12: warning: 
'*((void*)(& next)+24).std::__shared_count<>::_M_pi' may be used uninitialized 
in this function [-Wmaybe-uninitialized]
  288 |       auto next = *next_res;
      |            ^~~~
{code}

{code}
/home/keith/git/arrow/cpp/src/arrow/util/iterator.h:288:12: warning: 
'*((void*)(& next)+16).std::__shared_ptr<int, __gnu_cxx::_S_atomic>::_M_ptr' 
may be used uninitialized in this function [-Wmaybe-uninitialized]
[359/671] Building CXX object 
src/arrow/util/CMakeFiles/arrow-utility-test.dir/utf8_util_test.cc.o
/home/keith/git/arrow/cpp/src/arrow/util/utf8_util_test.cc: In function 
'arrow::util::UTF8FindIf_Basics_Test::TestBody()::<lambda(const string&, 
uint32_t, int64_t, int64_t)>':
/home/keith/git/arrow/cpp/src/arrow/util/utf8_util_test.cc:463:35: warning: 
'right' may be used uninitialized in this function [-Wmaybe-uninitialized]
  463 |     EXPECT_EQ(offset_right, right - begin);
      |                                   ^
{code}

{code}
/home/keith/git/arrow/cpp/src/arrow/util/utf8_util_test.cc:462:33: warning: 
'left' may be used uninitialized in this function [-Wmaybe-uninitialized]
  462 |     EXPECT_EQ(offset_left, left - begin);
      |                                 ^
{code}

{code}
/home/keith/git/arrow/cpp/src/arrow/util/utf8_util_test.cc: In function 
'arrow::util::UTF8FindIf_Basics_Test::TestBody()::<lambda(const string&, 
unsigned char, int64_t, int64_t)>':
/home/keith/git/arrow/cpp/src/arrow/util/utf8_util_test.cc:447:35: warning: 
'right' may be used uninitialized in this function [-Wmaybe-uninitialized]
  447 |     EXPECT_EQ(offset_right, right - begin);
      |                                   ^
{code}

{code}
/home/keith/git/arrow/cpp/src/arrow/util/utf8_util_test.cc:446:33: warning: 
'left' may be used uninitialized in this function [-Wmaybe-uninitialized]
  446 |     EXPECT_EQ(offset_left, left - begin);
      |                                 ^
{code}

{code}
/home/keith/git/arrow/cpp/src/arrow/util/variant_test.cc: In member function 
'virtual void arrow::util::{anonymous}::VariantTest_Visit_Test::TestBody()':
/home/keith/git/arrow/cpp/src/arrow/util/variant_test.cc:260:3: warning: 
'*((void*)&<anonymous> +8)' may be used uninitialized in this function 
[-Wmaybe-uninitialized]
  260 |   for (auto Assert :
      |   ^~~
{code}

{code}
/home/keith/git/arrow/cpp/src/arrow/util/variant_test.cc:230:8: warning: 
'<anonymous>.arrow::util::{anonymous}::AssertVisitOne<arrow::util::Variant<std::vector<int,
 std::allocator<int> >, const char*>, std::vector<int> >::expected_' may be 
used uninitialized in this function [-Wmaybe-uninitialized]
  230 | struct AssertVisitOne {
      |        ^~~~~~~~~~~~~~
{code}

{code}
/home/keith/git/arrow/cpp/src/arrow/gpu/cuda_benchmark.cc: In function 'void 
arrow::cuda::CudaBufferWriterBenchmark(benchmark::State&, int64_t, int64_t, 
int64_t)':
/home/keith/git/arrow/cpp/src/arrow/gpu/cuda_benchmark.cc:42:35: warning: 
'manager' may be used uninitialized in this function [-Wmaybe-uninitialized]
   42 |   ABORT_NOT_OK(manager->GetContext(kGpuNumber).Value(&context));
      |                                   ^
{code}

{code}
/home/keith/git/arrow/cpp/src/parquet/arrow/arrow_schema_test.cc: In function 
'arrow::Result<std::deque<parquet::internal::LevelInfo> > 
parquet::arrow::RootToTreeLeafLevels(const parquet::arrow::SchemaManifest&, 
int)':
/home/keith/git/arrow/cpp/src/parquet/arrow/arrow_schema_test.cc:1343:16: 
warning: 'field' may be used uninitialized in this function 
[-Wmaybe-uninitialized]
 1343 |   while (field != nullptr) {
      |          ~~~~~~^~~~~~~~~~
{code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to