epics-base / pvDataCPP

pvDataCPP is an EPICS V4 C++ module
https://epics-base.github.io/pvDataCPP/
Other
6 stars 16 forks source link

anyscalar.h: ... break strict-aliasing rules #60

Closed mdavidsaver closed 5 years ago

mdavidsaver commented 5 years ago
../../src/misc/pv/anyscalar.h: In member function 'void epics::pvData::PVScalarValue<T>::getAs(epics::pvData::AnyScalar&) const [with T = float]':
../../src/misc/pv/anyscalar.h:113: warning: dereferencing pointer '<anonymous>' does break strict-aliasing rules
../../src/misc/pv/anyscalar.h:113: note: initialized from here

As this has come up twice (by @dirk-zimoch ), I want to document the outcome.

This warning is (so far) only seen of GCC versions near 4.4.x. Neither older, nor newer, compilers are complaining (eg. gcc 6.3.0 doesn't). As long as this remains the case, and no mis-behavior is observed (eg. from testanyscalar), then I don't intent to take any action. Concerned users can build with -fno-strict-aliasing.