From 554fd8c5195424bdbcabf5de30fdc183aba391bd Mon Sep 17 00:00:00 2001 From: upstream source tree Date: Sun, 15 Mar 2015 20:14:05 -0400 Subject: obtained gcc-4.6.4.tar.bz2 from upstream website; verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository. --- libjava/testsuite/libjava.special/pr21115.java | 34 ++++++++ libjava/testsuite/libjava.special/pr21115.out | 0 libjava/testsuite/libjava.special/pr21115I.java | 20 +++++ libjava/testsuite/libjava.special/special.exp | 108 ++++++++++++++++++++++++ 4 files changed, 162 insertions(+) create mode 100644 libjava/testsuite/libjava.special/pr21115.java create mode 100644 libjava/testsuite/libjava.special/pr21115.out create mode 100644 libjava/testsuite/libjava.special/pr21115I.java create mode 100644 libjava/testsuite/libjava.special/special.exp (limited to 'libjava/testsuite/libjava.special') diff --git a/libjava/testsuite/libjava.special/pr21115.java b/libjava/testsuite/libjava.special/pr21115.java new file mode 100644 index 000000000..2e23f271e --- /dev/null +++ b/libjava/testsuite/libjava.special/pr21115.java @@ -0,0 +1,34 @@ +public abstract class pr21115 +{ + public static void main(String[] args) throws Exception + { + Class c = Class.forName("pr21115I"); + Object o = c.newInstance(); + pr21115 t = (pr21115) o; + // Try to fill the stack with 0xff. + t.test (0xffffffff, 0xffffffff, + 0xffffffff, 0xffffffff, + 0xffffffff, 0xffffffff, + 0xffffffff, 0xffffffff, + 0xffffffff, 0xffffffff); + // Pass a bunch of false (0) values. + if (t.test (false, false, + false, false, + false, false, + false, false, + false, false)) + System.out.println ("FAILED - expecting false return value."); + } + + public abstract boolean test(boolean a, boolean b, + boolean c, boolean d, + boolean e, boolean f, + boolean g, boolean h, + boolean i, boolean j); + + public abstract boolean test(int a, int b, + int c, int d, + int e, int f, + int g, int h, + int i, int j); +} diff --git a/libjava/testsuite/libjava.special/pr21115.out b/libjava/testsuite/libjava.special/pr21115.out new file mode 100644 index 000000000..e69de29bb diff --git a/libjava/testsuite/libjava.special/pr21115I.java b/libjava/testsuite/libjava.special/pr21115I.java new file mode 100644 index 000000000..17701ac07 --- /dev/null +++ b/libjava/testsuite/libjava.special/pr21115I.java @@ -0,0 +1,20 @@ +public class pr21115I extends pr21115 +{ + public boolean test(boolean a, boolean b, + boolean c, boolean d, + boolean e, boolean f, + boolean g, boolean h, + boolean i, boolean j) + { + return a && b && c && d && e && f && g && h && i; + } + + public boolean test(int a, int b, + int c, int d, + int e, int f, + int g, int h, + int i, int j) + { + return true; + } +} diff --git a/libjava/testsuite/libjava.special/special.exp b/libjava/testsuite/libjava.special/special.exp new file mode 100644 index 000000000..8397f8567 --- /dev/null +++ b/libjava/testsuite/libjava.special/special.exp @@ -0,0 +1,108 @@ +# Special test cases. These require tricky build procedures. + +proc gcj_special_try_compiler {} { + global srcdir subdir + return [bytecompile_file ${srcdir}/${subdir}/pr21115I.java [pwd]] +} + +proc gcj_special_pr21115 {} { + global srcdir subdir env + + # ---- PR 21115 ------------------------------------------------------- + + if {! [bytecompile_file ${srcdir}/${subdir}/pr21115I.java [pwd]]} { + fail "bytecompile ${srcdir}/${subdir}/libjava.special/pr21115I.java" + # FIXME - should use `untested' on all remaining tests. + # But that is hard. + return 0 + } + pass "bytecompile pr21115I.java" + + if {! [gcj_link pr21115 pr21115 [list ${srcdir}/${subdir}/pr21115.java]]} { + fail "compiling/linking pr21115.java" + # FIXME + return 0 + } + + if {! [gcj_invoke pr21115 ${srcdir}/${subdir}/pr21115.out ""]} { + # FIXME + return 0 + } + + return 1 +} + +# Write a .java file and bytecompile it. Return 0 on failure. +proc gcj_write_and_byte_compile {name contents} { + set fd [open $name w] + puts $fd $contents + close $fd + + if {! [bytecompile_file $name [pwd]]} { + fail "bytecompile $name" + # FIXME - should use `untested' on all remaining tests. + # But that is hard. + return 0 + } + pass "bytecompile $name" + return 1 +} + +# Check that BC-compiled code lazily throws IllegalAccessError. +proc gcj_special_lazy_illegal_access {} { + global srcdir subdir env + + # Write and compile the initial files. + if {! [gcj_write_and_byte_compile LazyA.java { + public class LazyA { + public static void m() { } + } + }]} { + return 0 + } + if {! [gcj_write_and_byte_compile LazyB.java { + public class LazyB { + public static void m() { } + public static void main(String[] args) { } + } + }]} { + return 0 + } + + # Create the expected output file. + set fd [open Lazy.out w] + close $fd + + # Now recompile LazyA with different access for m(). + if {! [gcj_write_and_byte_compile LazyA.java { + public class LazyA { + private static void m() { } + } + }]} { + return 0 + } + + # Link and run... this should still work, since we don't actually + # try to call LazyA.m(). + if {! [gcj_link Lazy LazyB {LazyA.class LazyB.class} \ + additional_flags=-findirect-dispatch]} { + fail "compiling/linking pr21115.java" + # FIXME + return 0 + } + + if {! [gcj_invoke Lazy Lazy.out ""]} { + # FIXME + return 0 + } + + return 1 +} + +# For these tests it is simpler to require that gcj work. So we try +# the compiler and if it fails, we simply skip the tests. + +if {[gcj_special_try_compiler]} { + gcj_special_pr21115 + gcj_special_lazy_illegal_access +} -- cgit v1.2.3