Uploaded image for project: 'Apache Arrow'
  1. Apache Arrow
  2. ARROW-4641

[C++] Flight builds complain of -Wstrict-aliasing

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 0.13.0
    • C++

    Description

      The compiler is rightly trying to protect us from doing a "bad thing", but I think this warning simply needs to be disabled in these compilation units

      /usr/bin/ccache /home/wesm/miniconda/envs/arrow-3.7/bin/x86_64-conda_cos6-linux-gnu-c++  -DARROW_EXTRA_ERROR_CONTEXT -DARROW_JEMALLOC -DARROW_JEMALLOC_INCLUDE_DIR=/home/wesm/code/arrow/cpp/build/jemalloc_ep-prefix/src/jemalloc_ep/dist//include -DARROW_NO_DEPRECATED_API -DARROW_USE_GLOG -DARROW_USE_SIMD -DARROW_WITH_BROTLI -DARROW_WITH_BZ2 -DARROW_WITH_LZ4 -DARROW_WITH_SNAPPY -DARROW_WITH_ZLIB -DARROW_WITH_ZSTD -Isrc -I../src -isystem /home/wesm/cpp-toolchain/include -isystem /home/wesm/miniconda/envs/arrow-3.7/include -isystem gbenchmark_ep/src/gbenchmark_ep-install/include -isystem jemalloc_ep-prefix/src -isystem /usr/local/hadoop/include -isystem /home/wesm/cpp-toolchain/include/thrift -Wno-noexcept-type -fvisibility-inlines-hidden -std=c++17 -fmessage-length=0 -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -pipe -O3 -DNDEBUG  -Wall -Wconversion -Wno-sign-conversion -Werror -msse4.2 -fno-omit-frame-pointer -O3 -DNDEBUG -fPIC   -std=gnu++11 -MD -MT src/arrow/flight/CMakeFiles/arrow_flight_objlib.dir/server.cc.o -MF src/arrow/flight/CMakeFiles/arrow_flight_objlib.dir/server.cc.o.d -o src/arrow/flight/CMakeFiles/arrow_flight_objlib.dir/server.cc.o -c ../src/arrow/flight/server.cc
      ../src/arrow/flight/server.cc: In member function 'virtual grpc::Status arrow::flight::FlightServiceImpl::DoGet(ServerContext*, const arrow::flight::protocol::Ticket*, ServerWriter<arrow::flight::protocol::FlightData>*)':
      ../src/arrow/flight/server.cc:192:75: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
           writer->Write(*reinterpret_cast<const pb::FlightData*>(&schema_payload),
                                                                                 ^
      ../src/arrow/flight/server.cc:199:75: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
                 !writer->Write(*reinterpret_cast<const pb::FlightData*>(&payload),
                                                                                 ^
      cc1plus: all warnings being treated as errors
      [11/113] Building CXX object src/arrow/flight/CMakeFiles/arrow_flight_objlib.dir/client.cc.o
      FAILED: src/arrow/flight/CMakeFiles/arrow_flight_objlib.dir/client.cc.o 
      /usr/bin/ccache /home/wesm/miniconda/envs/arrow-3.7/bin/x86_64-conda_cos6-linux-gnu-c++  -DARROW_EXTRA_ERROR_CONTEXT -DARROW_JEMALLOC -DARROW_JEMALLOC_INCLUDE_DIR=/home/wesm/code/arrow/cpp/build/jemalloc_ep-prefix/src/jemalloc_ep/dist//include -DARROW_NO_DEPRECATED_API -DARROW_USE_GLOG -DARROW_USE_SIMD -DARROW_WITH_BROTLI -DARROW_WITH_BZ2 -DARROW_WITH_LZ4 -DARROW_WITH_SNAPPY -DARROW_WITH_ZLIB -DARROW_WITH_ZSTD -Isrc -I../src -isystem /home/wesm/cpp-toolchain/include -isystem /home/wesm/miniconda/envs/arrow-3.7/include -isystem gbenchmark_ep/src/gbenchmark_ep-install/include -isystem jemalloc_ep-prefix/src -isystem /usr/local/hadoop/include -isystem /home/wesm/cpp-toolchain/include/thrift -Wno-noexcept-type -fvisibility-inlines-hidden -std=c++17 -fmessage-length=0 -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -pipe -O3 -DNDEBUG  -Wall -Wconversion -Wno-sign-conversion -Werror -msse4.2 -fno-omit-frame-pointer -O3 -DNDEBUG -fPIC   -std=gnu++11 -MD -MT src/arrow/flight/CMakeFiles/arrow_flight_objlib.dir/client.cc.o -MF src/arrow/flight/CMakeFiles/arrow_flight_objlib.dir/client.cc.o.d -o src/arrow/flight/CMakeFiles/arrow_flight_objlib.dir/client.cc.o -c ../src/arrow/flight/client.cc
      ../src/arrow/flight/client.cc: In member function 'virtual arrow::Status arrow::flight::FlightPutWriter::FlightPutWriterImpl::WriteRecordBatch(const arrow::RecordBatch&, bool)':
      ../src/arrow/flight/client.cc:126:74: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
           if (!writer_->Write(*reinterpret_cast<const pb::FlightData*>(&payload),
                                                                                ^
      ../src/arrow/flight/client.cc: In member function 'arrow::Status arrow::flight::FlightClient::FlightClientImpl::DoPut(const arrow::flight::FlightDescriptor&, const std::shared_ptr<arrow::Schema>&, std::unique_ptr<arrow::ipc::RecordBatchWriter>*)':
      ../src/arrow/flight/client.cc:310:79: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
           if (!write_stream->Write(*reinterpret_cast<const pb::FlightData*>(&payload),
                                                                                     ^
      cc1plus: all warnings being treated as errors
      [12/113] Performing configure step for 'jemalloc_ep'
      -- jemalloc_ep configure command succeeded.  See also /home/wesm/code/arrow/cpp/build/jemalloc_ep-prefix/src/jemalloc_ep-stamp/jemalloc_ep-configure-*.log
      [13/113] Building CXX object src/arrow/flight/CMakeFiles/arrow_flight_objlib.dir/protocol-internal.cc.o
      

      Attachments

        Issue Links

          Activity

            People

              wesm Wes McKinney
              wesm Wes McKinney
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 50m
                  50m