Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix an undefined C behavior.
authorMatthieu Volat <mazhe@alkumuna.eu>
Thu, 12 Jan 2017 13:13:47 +0000 (14:13 +0100)
committerdegomme <augustin.degomme@unibas.ch>
Thu, 12 Jan 2017 17:05:09 +0000 (18:05 +0100)
This will fix the minus operation on certain OS/compilers.

src/mc/DwarfExpression.cpp

index 6cdba68..03298eb 100644 (file)
@@ -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());