test/compiler/6855164/Test.java

Thu, 11 Apr 2013 21:45:21 -0700

author
amurillo
date
Thu, 11 Apr 2013 21:45:21 -0700
changeset 4915
5201379fe487
parent 1907
c18cbe5936b8
child 6876
710a3c8b516e
permissions
-rw-r--r--

Added tag hs25-b28 for changeset 6d88a566d369

cfang@1270 1 /*
trims@1907 2 * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
cfang@1270 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
cfang@1270 4 *
cfang@1270 5 * This code is free software; you can redistribute it and/or modify it
cfang@1270 6 * under the terms of the GNU General Public License version 2 only, as
cfang@1270 7 * published by the Free Software Foundation.
cfang@1270 8 *
cfang@1270 9 * This code is distributed in the hope that it will be useful, but WITHOUT
cfang@1270 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
cfang@1270 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
cfang@1270 12 * version 2 for more details (a copy is included in the LICENSE file that
cfang@1270 13 * accompanied this code).
cfang@1270 14 *
cfang@1270 15 * You should have received a copy of the GNU General Public License version
cfang@1270 16 * 2 along with this work; if not, write to the Free Software Foundation,
cfang@1270 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
cfang@1270 18 *
trims@1907 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@1907 20 * or visit www.oracle.com if you need additional information or have any
trims@1907 21 * questions.
cfang@1270 22 */
cfang@1270 23
cfang@1270 24 /*
cfang@1270 25 * @test
cfang@1270 26 * @bug 6855164
cfang@1270 27 * @summary SIGSEGV during compilation of method involving loop over CharSequence
cfang@1270 28 * @run main/othervm -Xbatch Test
cfang@1270 29 */
cfang@1270 30
cfang@1270 31 public class Test{
cfang@1270 32 public static void main(String[] args) throws Exception {
cfang@1270 33 StringBuffer builder = new StringBuffer();
cfang@1270 34
cfang@1270 35 for(int i = 0; i < 100; i++)
cfang@1270 36 builder.append("I am the very model of a modern major general\n");
cfang@1270 37
cfang@1270 38 for(int j = 0; j < builder.length(); j++){
cfang@1270 39 previousSpaceIndex(builder, j);
cfang@1270 40 }
cfang@1270 41 }
cfang@1270 42
cfang@1270 43 private static final int previousSpaceIndex(CharSequence sb, int seek) {
cfang@1270 44 seek--;
cfang@1270 45 while (seek > 0) {
cfang@1270 46 if (sb.charAt(seek) == ' ') {
cfang@1270 47 while (seek > 0 && sb.charAt(seek - 1) == ' ')
cfang@1270 48 seek--;
cfang@1270 49 return seek;
cfang@1270 50 }
cfang@1270 51 seek--;
cfang@1270 52 }
cfang@1270 53 return 0;
cfang@1270 54 }
cfang@1270 55 }

mercurial