Fix for bug 380927: VerifyError issue with inconsistent stack map frames
with do..while and nested switch statements.
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/StackMapAttributeTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/StackMapAttributeTest.java
index f6d4246..aa95982 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/StackMapAttributeTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/StackMapAttributeTest.java
@@ -7912,4 +7912,78 @@
 				assertEquals("Wrong contents", expectedOutput, actualOutput);
 			}
 	}
+	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=380927
+	// Verify the reduced range of locals.
+	public void testBug380927() throws Exception {
+		this.runConformTest(
+				new String[] {
+						"X.java",
+						"public class X {\n" +
+						"    public final static Object f() {\n" +
+						"        final Object a = null;\n" +
+						"        Object b;\n" +
+						"        label: do {\n" +
+						"            switch (0) {\n" +
+						"            case 1: {\n" +
+						"                b = a;\n" +
+						"            }\n" +
+						"                break;\n" +
+						"            default:\n" +
+						"                break label;\n" +
+						"            }\n" +
+						"        } while (true);\n" +
+						"        return a;\n" +
+						"    }\n" +
+						"    public static void main(final String[] args) {\n" +
+						"        f();\n" +
+						"        System.out.println(\"SUCCESS\");\n" +
+						"    }\n" +
+						"}\n"
+				},
+				"SUCCESS");
+
+			ClassFileBytesDisassembler disassembler = ToolFactory.createDefaultClassFileBytesDisassembler();
+			byte[] classFileBytes = org.eclipse.jdt.internal.compiler.util.Util.getFileByteContent(new File(OUTPUT_DIR + File.separator  +"X.class"));
+			String actualOutput =
+				disassembler.disassemble(
+					classFileBytes,
+					"\n",
+					ClassFileBytesDisassembler.DETAILED);
+
+			String expectedOutput =
+					"  // Method descriptor #15 ()Ljava/lang/Object;\n" + 
+					"  // Stack: 1, Locals: 2\n" + 
+					"  public static final java.lang.Object f();\n" + 
+					"     0  aconst_null\n" + 
+					"     1  astore_0 [a]\n" + 
+					"     2  iconst_0\n" + 
+					"     3  tableswitch default: 25\n" + 
+					"          case 1: 20\n" + 
+					"    20  aload_0 [a]\n" + 
+					"    21  astore_1 [b]\n" + 
+					"    22  goto 2\n" + 
+					"    25  aload_0 [a]\n" + 
+					"    26  areturn\n" + 
+					"      Line numbers:\n" + 
+					"        [pc: 0, line: 3]\n" + 
+					"        [pc: 2, line: 6]\n" + 
+					"        [pc: 20, line: 8]\n" + 
+					"        [pc: 22, line: 10]\n" + 
+					"        [pc: 25, line: 15]\n" + 
+					"      Local variable table:\n" + 
+					"        [pc: 2, pc: 27] local: a index: 0 type: java.lang.Object\n" + 
+					"        [pc: 22, pc: 25] local: b index: 1 type: java.lang.Object\n" + 
+					"      Stack map table: number of frames 3\n" + 
+					"        [pc: 2, append: {java.lang.Object}]\n" + 
+					"        [pc: 20, same]\n" + 
+					"        [pc: 25, same]\n" + 
+					"  \n"; 
+			int index = actualOutput.indexOf(expectedOutput);
+			if (index == -1 || expectedOutput.length() == 0) {
+				System.out.println(Util.displayString(actualOutput, 2));
+			}
+			if (index == -1) {
+				assertEquals("Wrong contents", expectedOutput, actualOutput);
+			}
+	}
 }
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SwitchTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SwitchTest.java
index 414e6e0..a0678a8 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SwitchTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SwitchTest.java
@@ -2166,8 +2166,6 @@
 }
 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=380927
 public void testBug380927() {
-	if (this.complianceLevel >= ClassFileConstants.JDK1_7)
-		return;
 	this.runConformTest(
 			new String[] {
 				"X.java",
@@ -2195,6 +2193,209 @@
 			},
 			"Success");	
 }
+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=380927
+public void testBug380927a() {
+	this.runConformTest(
+			new String[] {
+				"X.java",
+				"public class X {\n" +
+				"    public final static Object f() {\n" +
+				"        final Object a = null;\n" +
+				"        Object b;\n" +
+				"        label: while (true) {\n" +
+				"            switch (0) {\n" +
+				"            case 1: {\n" +
+				"                b = a;\n" +
+				"            }\n" +
+				"                break;\n" +
+				"            default:\n" +
+				"                break label;\n" +
+				"            }\n" +
+				"        }\n" +
+				"        return a;\n" +
+				"    }\n" +
+				"    public static void main(final String[] args) {\n" +
+				"        f();\n" +
+				"        System.out.println(\"Success\");\n" +
+				"    }\n" +
+				"}\n",
+			},
+			"Success");	
+}
+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=380927
+public void testBug380927b() {
+	this.runConformTest(
+			new String[] {
+				"X.java",
+				"public class X {\n" +
+				"    public final static Object f() {\n" +
+				"        final Object a = null;\n" +
+				"        Object b;\n" +
+				"        label: for(;;) {\n" +
+				"            switch (0) {\n" +
+				"            case 1: {\n" +
+				"                b = a;\n" +
+				"            }\n" +
+				"                break;\n" +
+				"            default:\n" +
+				"                break label;\n" +
+				"            }\n" +
+				"        }\n" +
+				"        return a;\n" +
+				"    }\n" +
+				"    public static void main(final String[] args) {\n" +
+				"        f();\n" +
+				"        System.out.println(\"Success\");\n" +
+				"    }\n" +
+				"}\n",
+			},
+			"Success");	
+}
+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=380927
+public void testBug380927c() {
+	if (this.complianceLevel < ClassFileConstants.JDK1_5)
+		return;
+	this.runConformTest(
+			new String[] {
+				"X.java",
+				"public class X {\n" +
+				"    public final static Object f() {\n" +
+				"        final Object a = null;\n" +
+				"        Object b;\n" +
+				"        label: for(int i : new int [] { 10 }) {\n" +
+				"            switch (0) {\n" +
+				"            case 1: {\n" +
+				"                b = a;\n" +
+				"            }\n" +
+				"                break;\n" +
+				"            default:\n" +
+				"                break label;\n" +
+				"            }\n" +
+				"        }\n" +
+				"        return a;\n" +
+				"    }\n" +
+				"    public static void main(final String[] args) {\n" +
+				"        f();\n" +
+				"        System.out.println(\"Success\");\n" +
+				"    }\n" +
+				"}\n",
+			},
+			"Success");	
+}
+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=380927
+public void testBug380927d() {
+	this.runNegativeTest(
+			new String[] {
+				"X.java",
+				"public class X {\n" +
+				"    public static void main(String [] args) {\n" +
+				"        Object b;\n" +
+				"        label: do {\n" +
+				"            switch (0) {\n" +
+				"            case 1:\n" +
+				"                b = null;\n" +
+				"                break;\n" +
+				"            default:\n" +
+				"                break label;\n" +
+				"            }\n" +
+				"        } while (true);\n" +
+				"        System.out.println(b);\n" +
+				"    }\n" +
+				"}\n",
+			},
+			"----------\n" + 
+			"1. ERROR in X.java (at line 13)\n" + 
+			"	System.out.println(b);\n" + 
+			"	                   ^\n" + 
+			"The local variable b may not have been initialized\n" + 
+			"----------\n");	
+}
+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=380927
+public void testBug380927e() {
+	this.runNegativeTest(
+			new String[] {
+				"X.java",
+				"public class X {\n" +
+				"    public static void main(String [] args) {\n" +
+				"        Object b;\n" +
+				"        label: while (true) {\n" +
+				"            switch (0) {\n" +
+				"            case 1:\n" +
+				"                b = null;\n" +
+				"                break;\n" +
+				"            default:\n" +
+				"                break label;\n" +
+				"            }\n" +
+				"        }\n" +
+				"        System.out.println(b);\n" +
+				"    }\n" +
+				"}\n",
+			},
+			"----------\n" + 
+			"1. ERROR in X.java (at line 13)\n" + 
+			"	System.out.println(b);\n" + 
+			"	                   ^\n" + 
+			"The local variable b may not have been initialized\n" + 
+			"----------\n");	
+}
+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=380927
+public void testBug380927f() {
+	this.runNegativeTest(
+			new String[] {
+				"X.java",
+				"public class X {\n" +
+				"    public static void main(String [] args) {\n" +
+				"        Object b;\n" +
+				"        label: for(;;) {\n" +
+				"            switch (0) {\n" +
+				"            case 1:\n" +
+				"                b = null;\n" +
+				"                break;\n" +
+				"            default:\n" +
+				"                break label;\n" +
+				"            }\n" +
+				"        }\n" +
+				"        System.out.println(b);\n" +
+				"    }\n" +
+				"}\n",
+			},
+			"----------\n" + 
+			"1. ERROR in X.java (at line 13)\n" + 
+			"	System.out.println(b);\n" + 
+			"	                   ^\n" + 
+			"The local variable b may not have been initialized\n" + 
+			"----------\n");	
+}
+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=380927
+public void testBug380927g() {
+	if (this.complianceLevel < ClassFileConstants.JDK1_5)
+		return;
+	this.runNegativeTest(
+			new String[] {
+				"X.java",
+				"public class X {\n" +
+				"    public static void main(String [] args) {\n" +
+				"        Object b;\n" +
+				"        label: for(int i : new int [] { 10 }) {\n" +
+				"            switch (0) {\n" +
+				"            case 1:\n" +
+				"                b = null;\n" +
+				"                break;\n" +
+				"            default:\n" +
+				"                break label;\n" +
+				"            }\n" +
+				"        }\n" +
+				"        System.out.println(b);\n" +
+				"    }\n" +
+				"}\n",
+			},
+			"----------\n" + 
+			"1. ERROR in X.java (at line 13)\n" + 
+			"	System.out.println(b);\n" + 
+			"	                   ^\n" + 
+			"The local variable b may not have been initialized\n" + 
+			"----------\n");	
+}
 public static Class testClass() {
 	return SwitchTest.class;
 }
diff --git a/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties b/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties
index 209c98b..cbcf442 100644
--- a/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties
+++ b/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties
@@ -21,7 +21,7 @@
 #Format: compiler.name = word1 word2 word3
 compiler.name = Eclipse Compiler for Java(TM)
 #Format: compiler.version = 0.XXX[, other words (don't forget the comma if adding other words)]
-compiler.version = 0.C57, 3.8.0
+compiler.version = 0.C58, 3.8.0
 compiler.copyright = Copyright IBM Corp 2000, 2012. All rights reserved.
 
 ### progress
diff --git a/org.eclipse.jdt.core/buildnotes_jdt-core.html b/org.eclipse.jdt.core/buildnotes_jdt-core.html
index e37497a..c1798d2 100644
--- a/org.eclipse.jdt.core/buildnotes_jdt-core.html
+++ b/org.eclipse.jdt.core/buildnotes_jdt-core.html
@@ -42,11 +42,24 @@
 	</td>
   </tr>
 </table>
+<a name="v_C58"></a>
+<hr><h1>
+Eclipse Platform Build Notes<br>
+Java development tools core</h1>
+Eclipse SDK 3.8.0 - May 31, 2012
+<br>Project org.eclipse.jdt.core v_C58
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_C58">cvs</a>).
+<h2>What's new in this drop</h2>
+
+<h3>Problem Reports Fixed</h3>
+<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=380927">380927</a>
+VerifyError issue with inconsistent stack map frames with do..while and nested switch statements.
+
 <a name="v_C57"></a>
 <hr><h1>
 Eclipse Platform Build Notes<br>
 Java development tools core</h1>
-Eclipse SDK 3.8.0 - May 29, 2012 - 3.8.0
+Eclipse SDK 3.8.0 - May 29, 2012
 <br>
 <h2>What's new in this drop</h2>
 
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/DoStatement.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/DoStatement.java
index 774c7aa..1fd8f3e 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/DoStatement.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/DoStatement.java
@@ -130,7 +130,7 @@
 								// recover upstream null info
 						isConditionOptimizedTrue,
 						(condInfo.tagBits & FlowInfo.UNREACHABLE) == 0
-								? flowInfo.addInitializationsFrom(condInfo.initsWhenFalse()) 
+								? flowInfo.copy().addInitializationsFrom(condInfo.initsWhenFalse()) // https://bugs.eclipse.org/bugs/show_bug.cgi?id=380927
 								: condInfo,
 							// recover null inits from before condition analysis
 						false, // never consider opt false case for DO loop, since break can always occur (47776)