diff options
author | Dmitriy Sobolev <Dmitriy.Sobolev@intel.com> | 2021-02-24 18:47:45 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-24 18:47:45 +0300 |
commit | f888bbb8a2b36f36de4999628555db14ca35f223 (patch) | |
tree | 980e0ac8d47b22b3882db09a44b1751ce95fb93b | |
parent | Fix segmentation fault in the global scan functor (#139) (diff) | |
download | llvm-project-f888bbb8a2b36f36de4999628555db14ca35f223.tar.gz llvm-project-f888bbb8a2b36f36de4999628555db14ca35f223.tar.bz2 llvm-project-f888bbb8a2b36f36de4999628555db14ca35f223.zip |
Turn off strict aliasing optimization if used (#137)
* Turn off strict aliasing optimization when use icpc on Linux
* Fix usage of CMAKE_CXX_COMPILER and CMAKE_BUILD_TYPE variables
* Make changes affect only tests
* Get rid of nested if condition
-rw-r--r-- | test/CMakeLists.txt | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 42cb57efcee1..c9faa4894052 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -30,6 +30,13 @@ macro(onedpl_add_test test_source_file) if (MSVC) target_compile_options(${_test_name} PRIVATE /bigobj) endif() + + # oneDPL test harness may initialize a C++ iterator using iterator with different type + # that may break code when using Intel(R) C++ Compiler Classic with -O3 flag on Linux + if (CMAKE_SYSTEM_NAME MATCHES "Linux" AND CMAKE_CXX_COMPILER_ID STREQUAL Intel) + target_compile_options(${_test_name} PRIVATE $<$<CONFIG:Release>:-fno-strict-aliasing>) + endif() + target_include_directories(${_test_name} PRIVATE "${CMAKE_CURRENT_LIST_DIR}") target_link_libraries(${_test_name} PRIVATE oneDPL) set_target_properties(${_test_name} PROPERTIES CXX_EXTENSIONS NO) |