2613N/A/*
2613N/A * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
2613N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2613N/A *
2613N/A * This code is free software; you can redistribute it and/or modify it
2613N/A * under the terms of the GNU General Public License version 2 only, as
2613N/A * published by the Free Software Foundation.
2613N/A *
2613N/A * This code is distributed in the hope that it will be useful, but WITHOUT
2613N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2613N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
2613N/A * version 2 for more details (a copy is included in the LICENSE file that
2613N/A * accompanied this code).
2613N/A *
2613N/A * You should have received a copy of the GNU General Public License version
2613N/A * 2 along with this work; if not, write to the Free Software Foundation,
2613N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2613N/A *
2613N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2613N/A * or visit www.oracle.com if you need additional information or have any
2613N/A * questions.
2613N/A *
2613N/A */
2613N/A
2613N/A/**
2613N/A * @test
2613N/A * @bug 7046096
2613N/A * @summary SEGV IN C2 WITH 6U25
2613N/A *
2613N/A * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+OptimizeStringConcat Test7046096
2613N/A */
2613N/A
2613N/A
2613N/Apublic class Test7046096 {
2613N/A
2613N/A static int first = 1;
2613N/A
2613N/A String add(String str) {
2613N/A if (first != 0) {
2613N/A return str + "789";
2613N/A } else {
2613N/A return "null";
2613N/A }
2613N/A }
2613N/A
2613N/A String test(String str) {
2613N/A for (int i=0; i < first; i++) {
2613N/A if (i > 1)
2613N/A return "bad";
2613N/A }
2613N/A return add(str+"456");
2613N/A }
2613N/A
2613N/A public static void main(String [] args) {
2613N/A Test7046096 t = new Test7046096();
2613N/A for (int i = 0; i < 11000; i++) {
2613N/A String str = t.test("123");
2613N/A if (!str.equals("123456789")) {
2613N/A System.out.println("FAILED: " + str + " != \"123456789\"");
2613N/A System.exit(97);
2613N/A }
2613N/A }
2613N/A }
2613N/A}
2613N/A