From: Daniel Arndt Date: Thu, 25 Jul 2019 04:38:19 +0000 (-0400) Subject: Disable __builtin_expect for Intel compiler with constexpr enabled X-Git-Tag: v9.2.0-rc1~1356^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=57dfcb9bb93ea93be4e97df6eb36be3f6f16be90;p=dealii.git Disable __builtin_expect for Intel compiler with constexpr enabled --- diff --git a/cmake/checks/check_02_compiler_features.cmake b/cmake/checks/check_02_compiler_features.cmake index e0f3225214..2ac63a12fb 100644 --- a/cmake/checks/check_02_compiler_features.cmake +++ b/cmake/checks/check_02_compiler_features.cmake @@ -120,14 +120,21 @@ CHECK_CXX_COMPILER_BUG( # prediction unit in some cases. We use it in the AssertThrow # macros. # +# Intel compilers don't handle __builtin_expect in C++14 constexpr contexts +# properly so we disable this feature in case we are going to use +# DEAL_II_CONSTEXPR with an Intel compiler. +# # - Matthias Maier, rewritten 2012 # -CHECK_CXX_SOURCE_COMPILES( - " - bool f() { return true; } - int main(){ if (__builtin_expect(f(),false)) {} } - " - DEAL_II_HAVE_BUILTIN_EXPECT) +IF(NOT(CMAKE_CXX_COMPILER_ID MATCHES "Intel" AND + DEAL_II_HAVE_CXX14_CONSTEXPR_CAN_CALL_NONCONSTEXPR)) + CHECK_CXX_SOURCE_COMPILES( + " + bool f() { return true; } + int main(){ if (__builtin_expect(f(),false)) {} } + " + DEAL_II_HAVE_BUILTIN_EXPECT) +ENDIF() #