kvn@1589: /* kvn@1589: * Copyright 2009 SAP. All Rights Reserved. kvn@1589: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. kvn@1589: * kvn@1589: * This code is free software; you can redistribute it and/or modify it kvn@1589: * under the terms of the GNU General Public License version 2 only, as kvn@1589: * published by the Free Software Foundation. kvn@1589: * kvn@1589: * This code is distributed in the hope that it will be useful, but WITHOUT kvn@1589: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or kvn@1589: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License kvn@1589: * version 2 for more details (a copy is included in the LICENSE file that kvn@1589: * accompanied this code). kvn@1589: * kvn@1589: * You should have received a copy of the GNU General Public License version kvn@1589: * 2 along with this work; if not, write to the Free Software Foundation, kvn@1589: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. kvn@1589: * trims@1907: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA trims@1907: * or visit www.oracle.com if you need additional information or have any trims@1907: * questions. kvn@1589: */ kvn@1589: kvn@1589: /** kvn@1589: * @test kvn@1589: * @bug 6910484 kvn@1589: * @summary incorrect integer optimization (loosing and op-r in a given example) kvn@1589: * kvn@1589: * @run main/othervm -Xbatch Test kvn@1589: */ kvn@1589: kvn@1589: public class Test { kvn@1589: kvn@1589: public static void main(String[] args) { kvn@1589: long iteration = 0; kvn@1589: for(int i = 0; i <11000; i++) { kvn@1589: iteration++; kvn@1589: int result = test(255); kvn@1589: if (result != 112) { kvn@1589: System.out.println("expected 112, but got " + result + " after iteration " + iteration); kvn@1589: System.exit(97); kvn@1589: } kvn@1589: } kvn@1589: } kvn@1589: kvn@1589: private static int test(int x) { kvn@1589: return (x & -32) / 2; kvn@1589: } kvn@1589: kvn@1589: }