From 562768839004b749c692db76b19a4dc94bf0ca74 Mon Sep 17 00:00:00 2001 From: Alexander Gorshenev Date: Mon, 28 Nov 2016 18:03:43 +0300 Subject: [PATCH] A million element byte array segfaults --- backend.native/tests/build.gradle | 6 ++++++ .../runtime/collections/moderately_large_array.kt | 12 ++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 backend.native/tests/runtime/collections/moderately_large_array.kt diff --git a/backend.native/tests/build.gradle b/backend.native/tests/build.gradle index 62039a1ce83..70f78195176 100644 --- a/backend.native/tests/build.gradle +++ b/backend.native/tests/build.gradle @@ -419,4 +419,10 @@ task array_list1(type: RunKonanTest) { goldValue = "OK\n" source = "runtime/collections/array_list1.kt" } +/* +task moderately_large_array(type: RunKonanTest) { + goldValue = "OK\n" + source = "runtime/collections/moderately_large_array.kt" +} +*/ diff --git a/backend.native/tests/runtime/collections/moderately_large_array.kt b/backend.native/tests/runtime/collections/moderately_large_array.kt new file mode 100644 index 00000000000..f10bb2a2481 --- /dev/null +++ b/backend.native/tests/runtime/collections/moderately_large_array.kt @@ -0,0 +1,12 @@ + +fun main(args: Array) { + val a = ByteArray(1000000) + + var sum = 0 + for (b in a) { + sum += b + } + + println(sum) +} +