Wes McKinney created ARROW-4641:
-----------------------------------
Summary: [C++] Flight builds complain of -Wstrict-aliasing
Key: ARROW-4641
URL: https://issues.apache.org/jira/browse/ARROW-4641
Project: Apache Arrow
Issue Type: Bug
Components: C++
Reporter: Wes McKinney
Fix For: 0.13.0
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
{code}
/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
{code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)