Skip to content

PIMeval: test-functional-fp cleanup #193

@fasiddique

Description

@fasiddique

Existing code shows following warning on Ubuntu:

test-functional-fp.h:49:18: warning: array subscript ‘const uint64_t {aka const long unsigned int}[0]’ is partly outside array bounds of ‘const float [1]’ [-Warray-bounds=]
   49 |   const uint64_t scalarVal = *reinterpret_cast<const uint64_t*>(&scalarValFloat);
      |                  ^~~~~~~~~
test-functional-fp.h:48:15: note: object ‘scalarValFloat’ of size 4
   48 |   const float scalarValFloat = 123.0;
      |               ^~~~~~~~~~~~~~
test-functional-fp.h: In instantiation of ‘bool testFunctional::testFp(const std::string&, PimDataType) [with T = float; std::string = std::__cxx11::basic_string<char>]’:
test-functional.cpp:51:22:   required from here
test-functional-fp.h:49:31: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
test-functional-fp.h:211:18: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
  211 |         T val = *reinterpret_cast<const T*>(&scalarVal);

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions