/* * Copyright 2011 Red Hat, Inc. 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. */ /* * @test LoopTest * @bug 6196102 5091921 * @summary verify that loop control variable is always computed correctly * @run main LoopTest * @author ptisnovs@redhat.com */ public class LoopTest { static public void main(String[] args) { int i1 = 0; int i2 = Integer.MAX_VALUE; while (i1 >= 0) { i1++; if (i1 > i2) { throw new RuntimeException("Failed when i1 == " + i1 + " and i2 == " + i2); } } } }