From 1f2c1c62789800b3ec20ed270b0165b86cd328dd Mon Sep 17 00:00:00 2001 From: Stephanos Ioannidis Date: Thu, 11 Aug 2022 03:30:17 +0900 Subject: [PATCH] cmake: compiler: gcc: Add no_strict_aliasing flag This commit adds the `no_strict_aliasing` flag, which disables the strict aliasing rule, for the GCC compiler and its derivatives. Signed-off-by: Stephanos Ioannidis --- cmake/compiler/gcc/compiler_flags.cmake | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmake/compiler/gcc/compiler_flags.cmake b/cmake/compiler/gcc/compiler_flags.cmake index d62931f2e28..b051e15b221 100644 --- a/cmake/compiler/gcc/compiler_flags.cmake +++ b/cmake/compiler/gcc/compiler_flags.cmake @@ -129,6 +129,9 @@ set_property(TARGET compiler-cpp PROPERTY dialect_cpp20 "-std=c++20" set_property(TARGET compiler-cpp PROPERTY dialect_cpp2b "-std=c++2b" "-Wno-register" "-Wno-volatile") +# Flag for disabling strict aliasing rule in C and C++ +set_compiler_property(PROPERTY no_strict_aliasing -fno-strict-aliasing) + # Disable exceptions flag in C++ set_property(TARGET compiler-cpp PROPERTY no_exceptions "-fno-exceptions")