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

[C++] Tests dereferencing type-punned pointer compiler warnings

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • None
    • 6.0.0
    • C++

    Description

      Using gcc9:
       

      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));
            |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      

      Attachments

        Issue Links

          Activity

            People

              keith.j.kraus Keith Kraus
              keith.j.kraus Keith Kraus
              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 - 1h
                  1h