Merge "Lazily introduce values for uninitialized debug locals."
diff --git a/src/test/java/com/android/tools/r8/shaking/B112290098.java b/src/test/java/com/android/tools/r8/shaking/B112290098.java
new file mode 100644
index 0000000..429853c
--- /dev/null
+++ b/src/test/java/com/android/tools/r8/shaking/B112290098.java
@@ -0,0 +1,59 @@
+// Copyright (c) 2018, the R8 project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+package com.android.tools.r8.shaking;
+
+import static junit.framework.TestCase.assertEquals;
+
+import com.android.tools.r8.TestBase;
+import com.android.tools.r8.utils.AndroidApp;
+import org.junit.Ignore;
+import org.junit.Test;
+
+public class B112290098 extends TestBase {
+
+  @Ignore("b/112290098")
+  @Test
+  public void test() throws Exception {
+    String mainClass = TestClass.class.getName();
+    AndroidApp input = readClasses(TestClass.class, C.class);
+    AndroidApp output =
+        compileWithR8(
+            input,
+            String.join(
+                System.lineSeparator(),
+                "-keep public class " + mainClass + " {",
+                "  public static void main(...);",
+                "}"));
+    assertEquals(runOnArt(compileWithD8(input), mainClass), runOnArt(output, mainClass));
+  }
+
+  public static class TestClass {
+
+    public static void main(String[] args) {
+      // Instantiation that will be removed as a result of class inlining.
+      new C();
+
+      C obj = null;
+      try {
+        // After inlining this will lead to an iget instruction.
+        obj.getField();
+      } catch (NullPointerException e) {
+        System.out.println("Caught NullPointerException");
+      }
+    }
+  }
+
+  public static class C {
+
+    // In the second round of tree shaking, C is no longer instantiated, but we should still
+    // keep this field to avoid a NoSuchFieldError instead of a NullPointerException at the
+    // obj.getField() invocation.
+    public int field = 42;
+
+    public int getField() {
+      return field;
+    }
+  }
+}