Test case for issue #1794388.
It demonstrates that, yes, there is a bug right now.
diff --git a/dx/tests/111-use-null-as-array/Blort.java b/dx/tests/111-use-null-as-array/Blort.java
new file mode 100644
index 0000000..c16684f
--- /dev/null
+++ b/dx/tests/111-use-null-as-array/Blort.java
@@ -0,0 +1,108 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public class Blort {
+ public static boolean test_getBooleanArray() {
+ boolean[] arr = null;
+ return arr[1];
+ }
+
+ public static byte test_getByteArray() {
+ byte[] arr = null;
+ return arr[2];
+ }
+
+ public static char test_getCharArray() {
+ char[] arr = null;
+ return arr[3];
+ }
+
+ public static double test_getDoubleArray() {
+ double[] arr = null;
+ return arr[4];
+ }
+
+ public static float test_getFloatArray() {
+ float[] arr = null;
+ return arr[5];
+ }
+
+ public static int test_getIntArray() {
+ int[] arr = null;
+ return arr[6];
+ }
+
+ public static long test_getLongArray() {
+ long[] arr = null;
+ return arr[7];
+ }
+
+ public static Object test_getObjectArray() {
+ Object[] arr = null;
+ return arr[8];
+ }
+
+ public static short test_getShortArray() {
+ short[] arr = null;
+ return arr[9];
+ }
+
+ public static void test_setBooleanArray() {
+ boolean[] arr = null;
+ arr[1] = true;
+ }
+
+ public static void test_setByteArray() {
+ byte[] arr = null;
+ arr[2] = (byte) 3;
+ }
+
+ public static void test_setCharArray() {
+ char[] arr = null;
+ arr[4] = (char) 5;
+ }
+
+ public static void test_setDoubleArray() {
+ double[] arr = null;
+ arr[6] = 7.0F;
+ }
+
+ public static void test_setFloatArray() {
+ float[] arr = null;
+ arr[8] = 9.0F;
+ }
+
+ public static void test_setIntArray() {
+ int[] arr = null;
+ arr[10] = 11;
+ }
+
+ public static void test_setLongArray() {
+ long[] arr = null;
+ arr[12] = 13;
+ }
+
+ public static void test_setObjectArray() {
+ Object[] arr = null;
+ arr[14] = "blort";
+ }
+
+ public static void test_setShortArray() {
+ short[] arr = null;
+ arr[15] = (short) 16;
+ }
+}
+
diff --git a/dx/tests/111-use-null-as-array/expected.txt b/dx/tests/111-use-null-as-array/expected.txt
new file mode 100644
index 0000000..58d5699
--- /dev/null
+++ b/dx/tests/111-use-null-as-array/expected.txt
@@ -0,0 +1,116 @@
+Blort.test_getBooleanArray:()Z:
+regs: 0002; ins: 0000; outs: 0000
+ 0000: const/4 v0, #null // #0
+ 0001: const/4 v1, #int 1 // #1
+ 0002: aget-boolean v0, v0, v1
+ 0004: return v0
+Blort.test_getByteArray:()B:
+regs: 0002; ins: 0000; outs: 0000
+ 0000: const/4 v0, #null // #0
+ 0001: const/4 v1, #int 2 // #2
+ 0002: aget-byte v0, v0, v1
+ 0004: return v0
+Blort.test_getCharArray:()C:
+regs: 0002; ins: 0000; outs: 0000
+ 0000: const/4 v0, #null // #0
+ 0001: const/4 v1, #int 3 // #3
+ 0002: aget-char v0, v0, v1
+ 0004: return v0
+Blort.test_getDoubleArray:()D:
+regs: 0002; ins: 0000; outs: 0000
+ 0000: const/4 v0, #null // #0
+ 0001: const/4 v1, #int 4 // #4
+ 0002: aget-wide v0, v0, v1
+ 0004: return-wide v0
+Blort.test_getFloatArray:()F:
+regs: 0002; ins: 0000; outs: 0000
+ 0000: const/4 v0, #null // #0
+ 0001: const/4 v1, #int 5 // #5
+ 0002: aget v0, v0, v1
+ 0004: return v0
+Blort.test_getIntArray:()I:
+regs: 0002; ins: 0000; outs: 0000
+ 0000: const/4 v0, #null // #0
+ 0001: const/4 v1, #int 6 // #6
+ 0002: aget v0, v0, v1
+ 0004: return v0
+Blort.test_getLongArray:()J:
+regs: 0002; ins: 0000; outs: 0000
+ 0000: const/4 v0, #null // #0
+ 0001: const/4 v1, #int 7 // #7
+ 0002: aget-wide v0, v0, v1
+ 0004: return-wide v0
+Blort.test_getObjectArray:()Ljava/lang/Object;:
+regs: 0002; ins: 0000; outs: 0000
+ 0000: const/4 v0, #null // #0
+ 0001: const/16 v1, #int 8 // #0008
+ 0003: aget-object v0, v0, v1
+ 0005: return-object v0
+Blort.test_getShortArray:()S:
+regs: 0002; ins: 0000; outs: 0000
+ 0000: const/4 v0, #null // #0
+ 0001: const/16 v1, #int 9 // #0009
+ 0003: aget-short v0, v0, v1
+ 0005: return v0
+Blort.test_setBooleanArray:()V:
+regs: 0002; ins: 0000; outs: 0000
+ 0000: const/4 v1, #int 1 // #1
+ 0001: const/4 v0, #null // #0
+ 0002: aput-boolean v1, v0, v1
+ 0004: return-void
+Blort.test_setByteArray:()V:
+regs: 0003; ins: 0000; outs: 0000
+ 0000: const/4 v0, #null // #0
+ 0001: const/4 v1, #int 2 // #2
+ 0002: const/4 v2, #int 3 // #3
+ 0003: aput-byte v2, v0, v1
+ 0005: return-void
+Blort.test_setCharArray:()V:
+regs: 0003; ins: 0000; outs: 0000
+ 0000: const/4 v0, #null // #0
+ 0001: const/4 v1, #int 4 // #4
+ 0002: const/4 v2, #int 5 // #5
+ 0003: aput-char v2, v0, v1
+ 0005: return-void
+Blort.test_setDoubleArray:()V:
+regs: 0004; ins: 0000; outs: 0000
+ 0000: const/4 v0, #null // #0
+ 0001: const/4 v1, #int 6 // #6
+ 0002: const-wide/high16 v2, #double 7.0 // #401c000000000000
+ 0004: aput-wide v2, v0, v1
+ 0006: return-void
+Blort.test_setFloatArray:()V:
+regs: 0003; ins: 0000; outs: 0000
+ 0000: const/4 v0, #null // #0
+ 0001: const/16 v1, #int 8 // #0008
+ 0003: const/high16 v2, #float 9.0 // #41100000
+ 0005: aput v2, v0, v1
+ 0007: return-void
+Blort.test_setIntArray:()V:
+regs: 0003; ins: 0000; outs: 0000
+ 0000: const/4 v0, #null // #0
+ 0001: const/16 v1, #int 10 // #000a
+ 0003: const/16 v2, #int 11 // #000b
+ 0005: aput v2, v0, v1
+ 0007: return-void
+Blort.test_setLongArray:()V:
+regs: 0004; ins: 0000; outs: 0000
+ 0000: const/4 v0, #null // #0
+ 0001: const/16 v1, #int 12 // #000c
+ 0003: const-wide/16 v2, #long 13 // #000d
+ 0005: aput-wide v2, v0, v1
+ 0007: return-void
+Blort.test_setObjectArray:()V:
+regs: 0003; ins: 0000; outs: 0000
+ 0000: const/4 v0, #null // #0
+ 0001: const/16 v1, #int 14 // #000e
+ 0003: const-string v2, "blort"
+ 0005: aput-object v2, v0, v1
+ 0007: return-void
+Blort.test_setShortArray:()V:
+regs: 0003; ins: 0000; outs: 0000
+ 0000: const/4 v0, #null // #0
+ 0001: const/16 v1, #int 15 // #000f
+ 0003: const/16 v2, #int 16 // #0010
+ 0005: aput-short v2, v0, v1
+ 0007: return-void
diff --git a/dx/tests/111-use-null-as-array/info.txt b/dx/tests/111-use-null-as-array/info.txt
new file mode 100644
index 0000000..fdcf844
--- /dev/null
+++ b/dx/tests/111-use-null-as-array/info.txt
@@ -0,0 +1,9 @@
+This is a smoke test of dex conversion, which checks to see that uses
+of a known-null in contexts that require a specific type end up getting
+converted to the type in question. When executed, this sort of code
+will inevitably throw a NullPointerException, but if the opcode weren't
+correct, they would instead incorrectly fail verification.
+
+This test compares emitted code against a known-good (via eyeballing)
+version, so it is possible for this test to spuriously fail if other
+aspects of conversion end up altering the output in innocuous ways.
diff --git a/dx/tests/111-use-null-as-array/run b/dx/tests/111-use-null-as-array/run
new file mode 100644
index 0000000..7e4e1e8
--- /dev/null
+++ b/dx/tests/111-use-null-as-array/run
@@ -0,0 +1,19 @@
+#!/bin/bash
+#
+# Copyright (C) 2009 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+$JAVAC -g -d . Blort.java
+dx --debug --dex --positions=none --no-locals \
+ --dump-to=- --dump-method="Blort.test*" *.class