Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

-Wstrict-aliasing warnings #15

Closed
phlptp opened this issue Jan 17, 2020 · 1 comment
Closed

-Wstrict-aliasing warnings #15

phlptp opened this issue Jan 17, 2020 · 1 comment
Assignees

Comments

@phlptp
Copy link
Collaborator

phlptp commented Jan 17, 2020

There are some strict-aliasing warnings in later Gcc versions that should be fixed.

In file included from /home/travis/build/GMLC-TDC/HELICS/ThirdParty/units/units/unit_definitions.hpp:9:0,
                 from /home/travis/build/GMLC-TDC/HELICS/ThirdParty/units/units/units.hpp:8,
                 from /home/travis/build/GMLC-TDC/HELICS/ThirdParty/units/units/units.cpp:7:
/home/travis/build/GMLC-TDC/HELICS/ThirdParty/units/units/units_decl.hpp: In member function ‘std::size_t std::hash<units::detail::unit_data>::operator()(const units::detail::unit_data&) const’:
/home/travis/build/GMLC-TDC/HELICS/ThirdParty/units/units/units_decl.hpp:315:78: warning: dereferencing type-punned pointer might break strict-aliasing rules [-Wstrict-aliasing]
         return hash<unsigned int>()(*reinterpret_cast<const unsigned int*>(&x));
                                                                              ^
[  3%] Building CXX object ThirdParty/utilities/gmlc/utilities/CMakeFiles/gmlc_utilities.dir/charMapper.cpp.o
[  3%] Building CXX object ThirdParty/jsoncpp/src/lib_json/CMakeFiles/jsoncpp_lib.dir/json_value.cpp.o
[  3%] Building CXX object ThirdParty/utilities/gmlc/utilities/CMakeFiles/gmlc_utilities.dir/string_viewOps.cpp.o
[  4%] Building CXX object ThirdParty/units/units/CMakeFiles/units-static.dir/x12_conv.cpp.o
[  4%] Building CXX object ThirdParty/fmtlib/CMakeFiles/fmt.dir/src/posix.cc.o
[  4%] Building CXX object ThirdParty/utilities/gmlc/utilities/CMakeFiles/gmlc_utilities.dir/stringOps.cpp.o
In file included from /home/travis/build/GMLC-TDC/HELICS/ThirdParty/units/units/unit_definitions.hpp:9:0,
                 from /home/travis/build/GMLC-TDC/HELICS/ThirdParty/units/units/units.hpp:8,
                 from /home/travis/build/GMLC-TDC/HELICS/ThirdParty/units/units/x12_conv.cpp:7:
/home/travis/build/GMLC-TDC/HELICS/ThirdParty/units/units/units_decl.hpp: In member function ‘std::size_t std::hash<units::detail::unit_data>::operator()(const units::detail::unit_data&) const’:
/home/travis/build/GMLC-TDC/HELICS/ThirdParty/units/units/units_decl.hpp:315:78: warning: dereferencing type-punned pointer might break strict-aliasing rules [-Wstrict-aliasing]
         return hash<unsigned int>()(*reinterpret_cast<const unsigned int*>(&x));
                                                                              ^
[  4%] Building CXX object ThirdParty/jsoncpp/src/lib_json/CMakeFiles/jsoncpp_lib.dir/json_writer.cpp.o

the warning should be added to compilation and the warnings fixed.

@phlptp phlptp self-assigned this Jan 17, 2020
@phlptp
Copy link
Collaborator Author

phlptp commented Jan 17, 2020

This appears to only show up on GCC 6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant