[Bf-blender-cvs] [ed9f8bd9566] master: CTest: Fix failing test BLI_expr_pylike_eval_test on clang/windows

Ray Molenkamp noreply at git.blender.org
Tue Oct 8 17:46:15 CEST 2019


Commit: ed9f8bd9566f0657558ca27b9cb16288a7ead074
Author: Ray Molenkamp
Date:   Tue Oct 8 09:46:09 2019 -0600
Branches: master
https://developer.blender.org/rBed9f8bd9566f0657558ca27b9cb16288a7ead074

CTest: Fix failing test BLI_expr_pylike_eval_test on clang/windows

clang got a little to aggressive discarding unused variables
see D6012 for details.

Differential Revision: https://developer.blender.org/D6012

Reviewers: brecht, sergey, angavrilov

===================================================================

M	source/blender/blenlib/intern/expr_pylike_eval.c

===================================================================

diff --git a/source/blender/blenlib/intern/expr_pylike_eval.c b/source/blender/blenlib/intern/expr_pylike_eval.c
index 14fc4c5bf26..b3692926838 100644
--- a/source/blender/blenlib/intern/expr_pylike_eval.c
+++ b/source/blender/blenlib/intern/expr_pylike_eval.c
@@ -504,7 +504,9 @@ static bool parse_add_func(ExprParseState *state, eOpCode code, int args, void *
       if (jmp_gap >= 1 && prev_ops[-1].opcode == OPCODE_CONST) {
         UnaryOpFunc func = funcptr;
 
-        double result = func(prev_ops[-1].arg.dval);
+        /* volatile because some compilers overly agressive optimize this call out.
+         * see D6012 for details. */
+        volatile double result = func(prev_ops[-1].arg.dval);
 
         if (fetestexcept(FE_DIVBYZERO | FE_INVALID) == 0) {
           prev_ops[-1].arg.dval = result;
@@ -520,7 +522,9 @@ static bool parse_add_func(ExprParseState *state, eOpCode code, int args, void *
           prev_ops[-1].opcode == OPCODE_CONST) {
         BinaryOpFunc func = funcptr;
 
-        double result = func(prev_ops[-2].arg.dval, prev_ops[-1].arg.dval);
+        /* volatile because some compilers overly agressive optimize this call out.
+         * see D6012 for details. */
+        volatile double result = func(prev_ops[-2].arg.dval, prev_ops[-1].arg.dval);
 
         if (fetestexcept(FE_DIVBYZERO | FE_INVALID) == 0) {
           prev_ops[-2].arg.dval = result;



More information about the Bf-blender-cvs mailing list