* tests/regression/jasmin/test_verify_fail_long_local.j:
authoredwin <none@none>
Thu, 14 Sep 2006 20:55:04 +0000 (20:55 +0000)
committeredwin <none@none>
Thu, 14 Sep 2006 20:55:04 +0000 (20:55 +0000)
Added comment.
* tests/regression/jasmin/test_verify_fail_double_overwritten.j:
New test.
* tests/regression/jasmin/test_verify_fail_invoke_basic_type.j:
New test.
* tests/regression/jasmin/test_verify_fail_long_overwritten.j:
New test.

--HG--
branch : unified_variables

tests/regression/jasmin/test_verify_fail_double_overwritten.j [new file with mode: 0644]
tests/regression/jasmin/test_verify_fail_invoke_basic_type.j [new file with mode: 0644]
tests/regression/jasmin/test_verify_fail_long_local.j
tests/regression/jasmin/test_verify_fail_long_overwritten.j [new file with mode: 0644]

diff --git a/tests/regression/jasmin/test_verify_fail_double_overwritten.j b/tests/regression/jasmin/test_verify_fail_double_overwritten.j
new file mode 100644 (file)
index 0000000..b6150e7
--- /dev/null
@@ -0,0 +1,51 @@
+.class public test_verify_fail_double_overwritten
+.super java/lang/Object
+
+; test: second half of double is overwritten by an int
+
+; ======================================================================
+
+.method public <init>()V
+   aload_0
+   invokenonvirtual java/lang/Object/<init>()V
+   return
+.end method
+
+; ======================================================================
+
+.method public static check(D)V
+       .limit locals 2
+       .limit stack 10
+       getstatic java/lang/System/out Ljava/io/PrintStream;
+       dload_0
+       invokevirtual java/io/PrintStream/println(D)V
+       return
+.end method
+
+; ======================================================================
+
+.method public static main([Ljava/lang/String;)V
+       .limit stack 2
+       .limit locals 3
+
+       ldc2_w 12.34
+       dstore 1
+
+       aload 0
+       ifnull force_basic_block_boundary
+
+       ; --------------------------------------------------
+
+       ldc 42
+       istore 2
+
+       ; --------------------------------------------------
+
+force_basic_block_boundary:
+
+       dload 1
+       ; ERROR: VerifyError
+       invokestatic test_verify_fail_double_overwritten/check(D)V
+
+       return
+.end method
diff --git a/tests/regression/jasmin/test_verify_fail_invoke_basic_type.j b/tests/regression/jasmin/test_verify_fail_invoke_basic_type.j
new file mode 100644 (file)
index 0000000..dca3886
--- /dev/null
@@ -0,0 +1,37 @@
+.class public test_verify_fail_invoke_basic_type
+.super java/lang/Object
+
+; ======================================================================
+
+.method public <init>()V
+   aload_0
+   invokenonvirtual java/lang/Object/<init>()V
+   return
+.end method
+
+; ======================================================================
+
+.method public static checkI(I)V
+       .limit locals 1
+       .limit stack 10
+       getstatic java/lang/System/out Ljava/io/PrintStream;
+       iload_0
+       invokevirtual java/io/PrintStream/println(I)V
+       return
+.end method
+
+; ======================================================================
+
+.method public static main([Ljava/lang/String;)V
+       .limit stack 2
+       .limit locals 2
+
+       ldc "test"
+       astore 1
+
+       aload 1
+       invokestatic test_verify_fail_invoke_basic_type/checkI(I)V
+       ; ERROR: VerifyError
+
+       return
+.end method
index 380528bfda032cf81a7542924020df370f701c8a..6a66e9ef96aac38c0743ab6857efbfe8fc48bc0e 100644 (file)
@@ -1,6 +1,8 @@
 .class public test_verify_fail_long_local
 .super java/lang/Object
 
+; long local overwrites int local in second half
+
 ; ======================================================================
 
 .method public <init>()V
diff --git a/tests/regression/jasmin/test_verify_fail_long_overwritten.j b/tests/regression/jasmin/test_verify_fail_long_overwritten.j
new file mode 100644 (file)
index 0000000..11e2dcb
--- /dev/null
@@ -0,0 +1,51 @@
+.class public test_verify_fail_long_overwritten
+.super java/lang/Object
+
+; test: second half of long is overwritten by an int
+
+; ======================================================================
+
+.method public <init>()V
+   aload_0
+   invokenonvirtual java/lang/Object/<init>()V
+   return
+.end method
+
+; ======================================================================
+
+.method public static check(J)V
+       .limit locals 2
+       .limit stack 10
+       getstatic java/lang/System/out Ljava/io/PrintStream;
+       lload_0
+       invokevirtual java/io/PrintStream/println(J)V
+       return
+.end method
+
+; ======================================================================
+
+.method public static main([Ljava/lang/String;)V
+       .limit stack 2
+       .limit locals 3
+
+       ldc2_w 1234567890987654321
+       lstore 1
+
+       aload 0
+       ifnull force_basic_block_boundary
+
+       ; --------------------------------------------------
+
+       ldc 42
+       istore 2
+
+       ; --------------------------------------------------
+
+force_basic_block_boundary:
+
+       lload 1
+       ; ERROR: VerifyError
+       invokestatic test_verify_fail_long_overwritten/check(J)V
+
+       return
+.end method