Commit c192be20 authored by Davi Arnaut's avatar Davi Arnaut

Bug#42733: Type-punning warnings when compiling MySQL -- strict aliasing violations.

Due to the extent of aliasing violations in the MySQL source
code, at this time it is safer to disable strict aliasing related
optimizations in release builds.

As of this patch, only GCC enables strict aliasing by default.
Hence, use the -fno-strict-aliasing option to disable the
aliasing rules.

cmake/build_configurations/mysql_release.cmake:
  Add -fno-strict-aliasing to release builds.
parent d40abf91
...@@ -131,12 +131,12 @@ IF(UNIX) ...@@ -131,12 +131,12 @@ IF(UNIX)
# Default GCC flags # Default GCC flags
IF(CMAKE_COMPILER_IS_GNUCC) IF(CMAKE_COMPILER_IS_GNUCC)
SET(COMMON_C_FLAGS "-g -static-libgcc -fno-omit-frame-pointer") SET(COMMON_C_FLAGS "-g -static-libgcc -fno-omit-frame-pointer -fno-strict-aliasing")
SET(CMAKE_C_FLAGS_DEBUG "-O ${COMMON_C_FLAGS}") SET(CMAKE_C_FLAGS_DEBUG "-O ${COMMON_C_FLAGS}")
SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-O3 ${COMMON_C_FLAGS}") SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-O3 ${COMMON_C_FLAGS}")
ENDIF() ENDIF()
IF(CMAKE_COMPILER_IS_GNUCXX) IF(CMAKE_COMPILER_IS_GNUCXX)
SET(COMMON_CXX_FLAGS "-g -static-libgcc -fno-omit-frame-pointer") SET(COMMON_CXX_FLAGS "-g -static-libgcc -fno-omit-frame-pointer -fno-strict-aliasing")
SET(CMAKE_CXX_FLAGS_DEBUG "-O ${COMMON_CXX_FLAGS}") SET(CMAKE_CXX_FLAGS_DEBUG "-O ${COMMON_CXX_FLAGS}")
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 ${COMMON_CXX_FLAGS}") SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 ${COMMON_CXX_FLAGS}")
ENDIF() ENDIF()
...@@ -176,9 +176,9 @@ IF(UNIX) ...@@ -176,9 +176,9 @@ IF(UNIX)
# OSX flags # OSX flags
IF(APPLE) IF(APPLE)
SET(COMMON_C_FLAGS "-g -fno-common") SET(COMMON_C_FLAGS "-g -fno-common -fno-strict-aliasing")
# XXX: why are we using -felide-constructors on OSX? # XXX: why are we using -felide-constructors on OSX?
SET(COMMON_CXX_FLAGS "-g -fno-common -felide-constructors") SET(COMMON_CXX_FLAGS "-g -fno-common -felide-constructors -fno-strict-aliasing")
SET(CMAKE_C_FLAGS_DEBUG "-O ${COMMON_C_FLAGS}") SET(CMAKE_C_FLAGS_DEBUG "-O ${COMMON_C_FLAGS}")
SET(CMAKE_CXX_FLAGS_DEBUG "-O ${COMMON_CXX_FLAGS}") SET(CMAKE_CXX_FLAGS_DEBUG "-O ${COMMON_CXX_FLAGS}")
SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-Os ${COMMON_C_FLAGS}") SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-Os ${COMMON_C_FLAGS}")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment