Merge branch 'master' of https://github.com/javapathfinder/jpf-core
authorVaibhav Sharma <vaibhav@umn.edu>
Wed, 24 Jan 2018 03:09:28 +0000 (21:09 -0600)
committerVaibhav Sharma <vaibhav@umn.edu>
Wed, 24 Jan 2018 03:09:28 +0000 (21:09 -0600)
src/main/gov/nasa/jpf/jvm/bytecode/DDIV.java

index 4c20b68dbda931fbeaccea80ae372712790d5b2e..c14099be1e54b550c0025fcfbd141ca2dc014957 100644 (file)
@@ -35,6 +35,11 @@ public class DDIV extends Instruction implements JVMInstruction {
     double v1 = frame.popDouble();
     double v2 = frame.popDouble();
     
+    if (v1 == 0) {
+        return ti.createAndThrowException("java.lang.ArithmeticException",
+                                          "division by zero");
+    }
+
     double r = v2 / v1;
     
     frame.pushDouble(r);