From f9ded5936173fb97fb0d5e5943d87fb91a114b51 Mon Sep 17 00:00:00 2001 From: Matthew Barr Date: Wed, 22 Jun 2016 15:03:22 +1000 Subject: [PATCH] Disable strict aliasing Strict aliasing allows to compiler to make some optimisations, but they aren't without risk. The benefits do not appear to be worth the risk. --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2652cea3..1b6e0e94 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -173,8 +173,8 @@ else() endif() # set compiler flags - more are tested and added later - set(EXTRA_C_FLAGS "-std=c99 -Wall -Wextra -Wshadow -Wcast-qual") - set(EXTRA_CXX_FLAGS "-std=c++11 -Wall -Wextra -Wno-shadow -Wswitch -Wreturn-type -Wcast-qual -Wno-deprecated -Wnon-virtual-dtor") + set(EXTRA_C_FLAGS "-std=c99 -Wall -Wextra -Wshadow -Wcast-qual -fno-strict-aliasing") + set(EXTRA_CXX_FLAGS "-std=c++11 -Wall -Wextra -Wno-shadow -Wswitch -Wreturn-type -Wcast-qual -Wno-deprecated -Wnon-virtual-dtor -fno-strict-aliasing") if (NOT RELEASE_BUILD) # -Werror is most useful during development, don't potentially break # release builds