8008215: break in catch clause causes java.lang.VerifyError: Inconsistent stackmap

Reviewed-by: jlaskey, lagergren
This commit is contained in:
Hannes Wallnöfer 2013-02-15 09:18:05 +01:00
parent f95919ab1e
commit 8edbed784d
3 changed files with 55 additions and 1 deletions

View file

@ -1742,6 +1742,10 @@ loop:
// TRY tested in caller.
next();
// Container block needed to act as target for labeled break statements
final Block outer = newBlock();
pushControlNode(outer);
// Create try.
final TryNode tryNode = new TryNode(source, tryToken, Token.descPosition(tryToken), findControl(TryNode.class));
pushControlNode(tryNode);
@ -1819,12 +1823,17 @@ loop:
tryNode.setCatchBlocks(catchBlocks);
tryNode.setFinallyBody(finallyStatements);
tryNode.setFinish(finish);
outer.setFinish(finish);
// Add try.
block.addStatement(tryNode);
outer.addStatement(tryNode);
} finally {
popControlNode(tryNode);
restoreBlock();
popControlNode(outer);
}
block.addStatement(new ExecuteNode(source, outer.getToken(), outer.getFinish(), outer));
}
/**

View file

@ -0,0 +1,41 @@
/*
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* JDK-8008215 : break in catch clause causes java.lang.VerifyError: Inconsistent stackmap
*
* @test
* @run
*/
a: try {
print("try");
throw new Error();
} catch (e) {
print("catch");
break a;
print("error");
} finally {
print("finally");
}
print("done");

View file

@ -0,0 +1,4 @@
try
catch
finally
done