From dad886659faca4fba2d4937c9bc6780591b02c27 Mon Sep 17 00:00:00 2001 From: Jason Zaugg Date: Sat, 3 Nov 2012 13:34:20 +0100 Subject: SI-6611 Tighten up an unsafe array optimization The net was cast too wide and was unsafely optimizing away array copies. --- test/files/instrumented/t6611.check | 1 + test/files/instrumented/t6611.scala | 13 +++++++++++++ test/files/run/t6611.scala | 6 ++++++ 3 files changed, 20 insertions(+) create mode 100644 test/files/instrumented/t6611.check create mode 100644 test/files/instrumented/t6611.scala create mode 100644 test/files/run/t6611.scala (limited to 'test') diff --git a/test/files/instrumented/t6611.check b/test/files/instrumented/t6611.check new file mode 100644 index 0000000000..5cd691e93a --- /dev/null +++ b/test/files/instrumented/t6611.check @@ -0,0 +1 @@ +Method call statistics: diff --git a/test/files/instrumented/t6611.scala b/test/files/instrumented/t6611.scala new file mode 100644 index 0000000000..821d5f3fbf --- /dev/null +++ b/test/files/instrumented/t6611.scala @@ -0,0 +1,13 @@ +import scala.tools.partest.instrumented.Instrumentation._ + +object Test { + def main(args: Array[String]) { + startProfiling() + + // tests optimization in Cleanup for varargs reference arrays + val a = Array("") + + stopProfiling() + printStatistics() + } +} diff --git a/test/files/run/t6611.scala b/test/files/run/t6611.scala new file mode 100644 index 0000000000..c0297372f0 --- /dev/null +++ b/test/files/run/t6611.scala @@ -0,0 +1,6 @@ +object Test extends App { + val a = Array("1") + val a2 = Array(a: _*) + a2(0) = "2" + assert(a(0) == "1") +} -- cgit v1.2.3