GrammaTech / gtirb

Intermediate Representation for Binary analysis and transformation
https://grammatech.github.io/gtirb/
Other
308 stars 37 forks source link

Strict aliasing #5

Closed AaronBallman closed 5 years ago

AaronBallman commented 6 years ago

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.

AaronBallman commented 5 years ago

I believe this issue is now resolved. The CMake files no longer pass -fno-strict-aliasing.