From ed9f8bd9566f0657558ca27b9cb16288a7ead074 Mon Sep 17 00:00:00 2001 From: Ray Molenkamp Date: Tue, 8 Oct 2019 09:46:09 -0600 Subject: 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 --- source/blender/blenlib/intern/expr_pylike_eval.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to '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; -- cgit v1.2.3