GSL requires you to pass -fno-strict-aliasing in Clang and GCC in order to avoid potential issues stemming from undefined behavior around strict aliasing, and we do this in the CMake files.
However, the protobuf-generated header files (Foo.pb.h) all also ignore strict aliasing warnings using #pragma GCC diagnostic ignored "-Wstrict-aliasing". I think we need to disable strict aliasing optimizations here as well.
However, it's really unfortunate to have to disable compiler features because we want to rely on undefined behavior. This makes me worry for the other compilers our end users use when compiling the library and what users should do if that UB causes them runtime problems.
GSL requires you to pass -fno-strict-aliasing in Clang and GCC in order to avoid potential issues stemming from undefined behavior around strict aliasing, and we do this in the CMake files.
However, the protobuf-generated header files (Foo.pb.h) all also ignore strict aliasing warnings using
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
. I think we need to disable strict aliasing optimizations here as well.However, it's really unfortunate to have to disable compiler features because we want to rely on undefined behavior. This makes me worry for the other compilers our end users use when compiling the library and what users should do if that UB causes them runtime problems.