From: Arnaud Giersch Date: Wed, 14 Mar 2018 21:50:59 +0000 (+0100) Subject: Make icc honor parentheses (fix lmm_usage). X-Git-Tag: v3.19~46 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/8d00a11d518c329ff699505e9b98444abc485bbb?hp=2a1dda68beb91ffc5514501ded2e03c3fe42b760 Make icc honor parentheses (fix lmm_usage). Without that, the expression in lagrange.cpp:405 sigma_i = (sigma_i - cnst.lambda) + lambda; seems to be evaluated in a different order, leading to an assertion failure. --- diff --git a/tools/cmake/GCCFlags.cmake b/tools/cmake/GCCFlags.cmake index b147dbfe9a..d9ae691b0f 100644 --- a/tools/cmake/GCCFlags.cmake +++ b/tools/cmake/GCCFlags.cmake @@ -84,6 +84,10 @@ if(enable_compile_optimizations AND CMAKE_COMPILER_IS_GNUCC # This is redundant (already in -03): set(optCFLAGS "${optCFLAGS} -finline-functions ") endif() +if (CMAKE_C_COMPILER_ID MATCHES "Intel") + # honor parentheses when determining the order of expression evaluation. + set(optCFLAGS "${optCFLAGS} -fprotect-parens ") +endif() # Do not leak the current directory into the binaries if(CMAKE_COMPILER_IS_GNUCC)