Stack overflow error and unit test.
Change-Id: Ie7198569207b1b87c50d986df002c551ad5d7d3a
diff --git a/test/IntMath/IntMath.java b/test/IntMath/IntMath.java
index c43d09e..e5fa806 100644
--- a/test/IntMath/IntMath.java
+++ b/test/IntMath/IntMath.java
@@ -786,6 +786,25 @@
return res;
}
+ static long recursion_count_;
+ static void throwStackOverflow(long l) {
+ recursion_count_++;
+ throwStackOverflow(recursion_count_);
+ }
+
+ static long testStackOverflow() {
+ try {
+ throwStackOverflow(0);
+ if (recursion_count_ != 0) {
+ return recursion_count_;
+ } else {
+ return -1;
+ }
+ } catch(StackOverflowError soe) {
+ return 0;
+ }
+ }
+
public static void main(String[] args) {
boolean failure = false;
int res;
@@ -947,6 +966,14 @@
failure = true;
}
+ lres= testStackOverflow();
+ if (lres == 0) {
+ System.out.println("testStackOverflow PASSED");
+ } else {
+ System.out.println("testStackOverflow FAILED: " + lres);
+ failure = true;
+ }
+
res = manyArgs(0, 1L, 2, 3L, 4, 5L, 6, 7, 8.0, 9.0f, 10.0,
(short)11, 12, (char)13, 14, 15, (byte)-16, true, 18,
19, 20L, 21L, 22, 23, 24, 25, 26);