test/compiler/6796786/Test6796786.java

Thu, 17 Apr 2014 16:09:08 -0700

author
amurillo
date
Thu, 17 Apr 2014 16:09:08 -0700
changeset 6635
49b5160951dd
parent 2879
37e4df3c8952
child 6876
710a3c8b516e
permissions
-rw-r--r--

Added tag hs25.20-b11 for changeset b6a2ba7d3ea7

never@2870 1 /*
never@2870 2 * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
never@2870 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
never@2870 4 *
never@2870 5 * This code is free software; you can redistribute it and/or modify it
never@2870 6 * under the terms of the GNU General Public License version 2 only, as
never@2870 7 * published by the Free Software Foundation.
never@2870 8 *
never@2870 9 * This code is distributed in the hope that it will be useful, but WITHOUT
never@2870 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
never@2870 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
never@2870 12 * version 2 for more details (a copy is included in the LICENSE file that
never@2870 13 * accompanied this code).
never@2870 14 *
never@2870 15 * You should have received a copy of the GNU General Public License version
never@2870 16 * 2 along with this work; if not, write to the Free Software Foundation,
never@2870 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
never@2870 18 *
never@2870 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
never@2870 20 * or visit www.oracle.com if you need additional information or have any
never@2870 21 * questions.
never@2870 22 *
never@2870 23 */
never@2870 24
never@2870 25 /**
never@2870 26 * @test
never@2870 27 * @bug 6796786
never@2870 28 * @summary invalid FP identity transform - (a - b) -> b - a
never@2870 29 *
kvn@2879 30 * @run main/othervm -Xbatch Test6796786
never@2870 31 */
never@2870 32
never@2870 33 public class Test6796786 {
never@2870 34 static volatile float d1;
never@2870 35 static volatile float d2;
never@2870 36
never@2870 37 public static void main(String[] args) {
never@2870 38 int total = 0;
never@2870 39 for (int i = 0; i < 100000; i++) {
kvn@2879 40 if (Float.floatToRawIntBits(- (d1 - d2)) == Float.floatToRawIntBits(-0.0f)) {
never@2870 41 total++;
never@2870 42 }
never@2870 43 }
never@2870 44 if (total != 100000) {
never@2870 45 throw new InternalError();
never@2870 46 }
never@2870 47 }
never@2870 48 }

mercurial