Keith Kraus created ARROW-13602:
-----------------------------------
Summary: [C++] Tests dereferencing type-punned pointer compiler
warnings
Key: ARROW-13602
URL: https://issues.apache.org/jira/browse/ARROW-13602
Project: Apache Arrow
Issue Type: Bug
Components: C++
Reporter: Keith Kraus
Using gcc9:
{code}
In file included from /home/keith/miniconda3/envs/dev/include/gtest/gtest.h:375,
from
/home/keith/miniconda3/envs/dev/include/gmock/internal/gmock-internal-utils.h:47,
from
/home/keith/miniconda3/envs/dev/include/gmock/gmock-actions.h:51,
from /home/keith/miniconda3/envs/dev/include/gmock/gmock.h:59,
from
/home/keith/git/arrow/cpp/src/arrow/util/bit_util_test.cc:30:
/home/keith/git/arrow/cpp/src/arrow/util/bit_util_test.cc: In member function
'virtual void arrow::BitUtil_ByteSwap_Test::TestBody()':
/home/keith/git/arrow/cpp/src/arrow/util/bit_util_test.cc:1835:32: warning:
dereferencing type-punned pointer will break strict-aliasing rules
[-Wstrict-aliasing]
1835 | EXPECT_EQ(BitUtil::ByteSwap(*reinterpret_cast<float*>(&srci32)),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/keith/git/arrow/cpp/src/arrow/util/bit_util_test.cc:1836:14: warning:
dereferencing type-punned pointer will break strict-aliasing rules
[-Wstrict-aliasing]
1836 | *reinterpret_cast<float*>(&expectedi32));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/keith/git/arrow/cpp/src/arrow/util/bit_util_test.cc:1838:32: warning:
dereferencing type-punned pointer will break strict-aliasing rules
[-Wstrict-aliasing]
1838 | EXPECT_EQ(BitUtil::ByteSwap(*reinterpret_cast<double*>(&srci64)),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/keith/git/arrow/cpp/src/arrow/util/bit_util_test.cc:1839:14: warning:
dereferencing type-punned pointer will break strict-aliasing rules
[-Wstrict-aliasing]
1839 | *reinterpret_cast<double*>(&expectedi64));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
{code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)