From: Matthieu Volat Date: Thu, 12 Jan 2017 13:13:47 +0000 (+0100) Subject: Fix an undefined C behavior. X-Git-Tag: v3_15~557 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/366e4448e231ced837b609f05f73f2aabe5e0750?hp=30d088f255192e7dde37bf961570af5b1c1db153 Fix an undefined C behavior. This will fix the minus operation on certain OS/compilers. --- diff --git a/src/mc/DwarfExpression.cpp b/src/mc/DwarfExpression.cpp index 6cdba68ae1..03298eb6ba 100644 --- a/src/mc/DwarfExpression.cpp +++ b/src/mc/DwarfExpression.cpp @@ -225,9 +225,12 @@ void execute( stack.top() = - (intptr_t) stack.top(); break; - case DW_OP_minus: - stack.push(stack.pop() - stack.pop()); + case DW_OP_minus: { + intptr_t first = stack.pop(); + intptr_t second = stack.pop(); + stack.push(second - first); break; + } case DW_OP_and: stack.push(stack.pop() & stack.pop());