summaryrefslogtreecommitdiff
path: root/test/files
diff options
context:
space:
mode:
authorVlad Ureche <vlad.ureche@gmail.com>2012-08-16 01:57:23 -0700
committerVlad Ureche <vlad.ureche@gmail.com>2012-08-16 01:57:23 -0700
commit5741d4861802ea449b880b87006daa5fc8bc907a (patch)
treef271ed7ef76063230065dee73b255c7394ea6b29 /test/files
parentcb61acac76c146c1d9bbf912952fa215f6e182b5 (diff)
parent41bf9c3c35472fda8bb06db717850886c4270379 (diff)
downloadscala-5741d4861802ea449b880b87006daa5fc8bc907a.tar.gz
scala-5741d4861802ea449b880b87006daa5fc8bc907a.tar.bz2
scala-5741d4861802ea449b880b87006daa5fc8bc907a.zip
Merge pull request #1141 from VladUreche/issue/asm
Fixes backend crash due to incorrect consumedTypes
Diffstat (limited to 'test/files')
-rw-r--r--test/files/run/dead-code-elimination.check0
-rw-r--r--test/files/run/dead-code-elimination.flags1
-rw-r--r--test/files/run/dead-code-elimination.scala33
3 files changed, 34 insertions, 0 deletions
diff --git a/test/files/run/dead-code-elimination.check b/test/files/run/dead-code-elimination.check
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/test/files/run/dead-code-elimination.check
diff --git a/test/files/run/dead-code-elimination.flags b/test/files/run/dead-code-elimination.flags
new file mode 100644
index 0000000000..49d036a887
--- /dev/null
+++ b/test/files/run/dead-code-elimination.flags
@@ -0,0 +1 @@
+-optimize
diff --git a/test/files/run/dead-code-elimination.scala b/test/files/run/dead-code-elimination.scala
new file mode 100644
index 0000000000..1af17c936b
--- /dev/null
+++ b/test/files/run/dead-code-elimination.scala
@@ -0,0 +1,33 @@
+
+// This testcase is a snippet that did not compile correctly under
+// pre-release 2.10.x. The relevant discussion around it can be
+// found at:
+// https://groups.google.com/forum/?fromgroups#!topic/scala-internals/qcyTjk8euUI[1-25]
+//
+// The reason it did not compile is related to the fact that ICode
+// ops did not correctly define the stack entries they consumed and
+// the dead code elimination phase was unable to correctly reconstruct
+// the stack after code elimination.
+//
+// Originally, this did not compile, but I included it in the run
+// tests because this was ASM-dependand and did not happen for GenJVM.
+//
+// Thus, we run the code and force the loading of class B -- if the
+// bytecode is incorrect, it will fail the test.
+
+final class A {
+ def f1 = true
+ def f2 = true
+ @inline def f3 = f1 || f2
+ class B {
+ def f() = 1 to 10 foreach (_ => f3)
+ }
+ def f = (new B).f()
+}
+
+object Test {
+ def main(args: Array[String]): Unit = {
+ // force the loading of B
+ (new A).f
+ }
+}