Wed, 27 Aug 2008 14:47:32 -0700
6741738: TypePtr::add_offset() set incorrect offset when the add overflows
Summary: Set offset to OffsetBot when the add overflows in TypePtr::add_offset()
Reviewed-by: jrose, never
kvn@741 | 1 | /* |
kvn@741 | 2 | * Copyright 2008 Sun Microsystems, Inc. All Rights Reserved. |
kvn@741 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
kvn@741 | 4 | * |
kvn@741 | 5 | * This code is free software; you can redistribute it and/or modify it |
kvn@741 | 6 | * under the terms of the GNU General Public License version 2 only, as |
kvn@741 | 7 | * published by the Free Software Foundation. |
kvn@741 | 8 | * |
kvn@741 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
kvn@741 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
kvn@741 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
kvn@741 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
kvn@741 | 13 | * accompanied this code). |
kvn@741 | 14 | * |
kvn@741 | 15 | * You should have received a copy of the GNU General Public License version |
kvn@741 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
kvn@741 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
kvn@741 | 18 | * |
kvn@741 | 19 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
kvn@741 | 20 | * CA 95054 USA or visit www.sun.com if you need additional information or |
kvn@741 | 21 | * have any questions. |
kvn@741 | 22 | */ |
kvn@741 | 23 | |
kvn@741 | 24 | /* |
kvn@741 | 25 | * @test |
kvn@741 | 26 | * @bug 6741738 |
kvn@741 | 27 | * @summary TypePtr::add_offset() set incorrect offset when the add overflows |
kvn@741 | 28 | * @run main/othervm -Xcomp -XX:CompileOnly=Tester.foo Tester |
kvn@741 | 29 | */ |
kvn@741 | 30 | |
kvn@741 | 31 | public class Tester { |
kvn@741 | 32 | private String[] values; |
kvn@741 | 33 | private int count; |
kvn@741 | 34 | |
kvn@741 | 35 | String foo() { |
kvn@741 | 36 | int i = Integer.MAX_VALUE-1; |
kvn@741 | 37 | String s; |
kvn@741 | 38 | try { |
kvn@741 | 39 | s = values[i]; |
kvn@741 | 40 | } catch (Throwable e) { |
kvn@741 | 41 | s = ""; |
kvn@741 | 42 | } |
kvn@741 | 43 | return s; |
kvn@741 | 44 | } |
kvn@741 | 45 | |
kvn@741 | 46 | public static void main(String[] args) { |
kvn@741 | 47 | Tester t = new Tester(); |
kvn@741 | 48 | String s = t.foo(); |
kvn@741 | 49 | } |
kvn@741 | 50 | } |