From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18797 invoked by alias); 7 Dec 2001 14:36:01 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 18755 invoked by uid 71); 7 Dec 2001 14:36:00 -0000 Resent-Date: 7 Dec 2001 14:36:00 -0000 Resent-Message-ID: <20011207143600.18754.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-To: nobody@gcc.gnu.org Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org, java-prs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, r.hautz@inn-salzach.de Received:(qmail 14579 invoked from network); 7 Dec 2001 14:27:00 -0000 Received: from unknown (HELO isabella.iivs.de) (212.144.64.63) by sources.redhat.com with SMTP; 7 Dec 2001 14:27:00 -0000 Received: (from roland@localhost) by isabella.iivs.de (8.11.6/8.11.6/SuSE Linux 0.5) id fB7EDkF01418; Fri, 7 Dec 2001 15:13:46 +0100 Message-Id:<200112071413.fB7EDkF01418@isabella.iivs.de> Date: Fri, 07 Dec 2001 06:36:00 -0000 From: roland@isabella.iivs.de Reply-To: r.hautz@inn-salzach.de To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version:3.113 Subject: java/5042: java: wrong addressing of inner class attributes X-SW-Source: 2001-12/txt/msg00428.txt.bz2 List-Id: >Number: 5042 >Category: java >Synopsis: java: wrong addressing of inner class attributes >Confidential: no >Severity: critical >Priority: medium >Responsible: unassigned >State: open >Class: wrong-code >Submitter-Id: net >Arrival-Date: Fri Dec 07 06:36:00 PST 2001 >Closed-Date: >Last-Modified: >Originator: >Release: 3.1 20011206 (experimental) >Organization: >Environment: System: Linux isabella 2.4.10-4GB #1 Tue Sep 25 12:33:54 GMT 2001 i586 unknown Architecture: i586 host: i586-pc-linux-gnu build: i586-pc-linux-gnu target: i586-pc-linux-gnu configured with: /home/roland/gcc/configure : (reconfigured) /home/roland/gcc/configure --enable-threads=posix --enable-shared --enable-languages=c++,java : (reconfigured) /home/roland/gcc/configure : (reconfigured) /home/roland/gcc/configure --disable-libf2c : (reconfigured) /home/roland/gcc/configure --enable-threads=posix --enable-languages=c,c++,java : (reconfigured) : (reconfigured) >Description: A Xerces1 built with gcj throws an exception, where a jvm succeeds. I debugged the problematic area and found failing references to attributes of an inner class, that was defined in another file. The problematic area is /org/apache/xerces/readers/AbstractCharReader.java: public boolean scanExpectedName(char fastcheck, StringPool.CharArrayRange expectedName) throws Exception { char[] expected = expectedName.chars; int offset = expectedName.offset; int len = expectedName.length; int ch = fMostRecentChar; for (int i = 0; i < len; i++) { if (ch != expected[offset++]) { Note the type of the expectedName parameter: StringPool.CharArrayRange. It is defined in org/apache/xerces/utils/StringPool.java: public final class StringPool { ... public class CharArrayRange { public char[] chars; public int offset; public int length; } The assembler code was generated via libtool with gcj --encoding=UTF-8 -fassume-compiled\ -fCLASSPATH=../../../../../src -ffloat-store\ -gstabs+ --save-temps -MD -MT AbstractCharReader.lo -MF\ AbstractCharReader.d -c AbstractCharReader.java\ -o AbstractCharReader.o Here the relevant parts from AbstractCharReader.s . [........] .stabs "_ZN3org6apache6xerces7readers18AbstractCharReader16scanExpectedNameEwPNS1_5utils30StringPool__U24_CharArrayRangeE:F(0,10)",36,0,50463458,_ZN3org6apache6xerces7readers18AbstractCharReader16scanExpectedNameEwPNS1_5utils30StringPool__U24_CharArrayRangeE .stabs "this:p(0,35)",160,0,738,8 .stabs "fastcheck:p(0,1)",160,0,738,12 .stabs "expectedName:p(0,55)=*(0,56)=xsorg.apache.xerces.utils.StringPool$CharArrayRange:",160,0,738,16 .globl _ZN3org6apache6xerces7readers18AbstractCharReader16scanExpectedNameEwPNS1_5utils30StringPool__U24_CharArrayRangeE .type _ZN3org6apache6xerces7readers18AbstractCharReader16scanExpectedNameEwPNS1_5utils30StringPool__U24_CharArrayRangeE,@function _ZN3org6apache6xerces7readers18AbstractCharReader16scanExpectedNameEwPNS1_5utils30StringPool__U24_CharArrayRangeE: [...] .stabn 68,0,739,.LM407-_ZN3org6apache6xerces7readers18AbstractCharReader16scanExpectedNameEwPNS1_5utils30StringPool__U24_CharArrayRangeE .LM407: movl 16(%ebp), %eax movl 4(%eax), %eax movl %eax, -8(%ebp) .LBB139: .stabn 68,0,740,.LM408-_ZN3org6apache6xerces7readers18AbstractCharReader16scanExpectedNameEwPNS1_5utils30StringPool__U24_CharArrayRangeE .LM408: movl 16(%ebp), %eax movl 8(%eax), %eax movl %eax, -12(%ebp) .LBB140: .stabn 68,0,741,.LM409-_ZN3org6apache6xerces7readers18AbstractCharReader16scanExpectedNameEwPNS1_5utils30StringPool__U24_CharArrayRangeE .LM409: movl 16(%ebp), %eax movl 12(%eax), %eax movl %eax, -16(%ebp) [........] .stabs "fastcheck:(0,2)",128,0,738,-2 .stabs "expected:(0,53)",128,0,739,-8 .stabn 192,0,0,.LBB138-.LFB22 .stabs "offset:(0,1)",128,0,740,-12 .stabn 192,0,0,.LBB139-.LFB22 .stabs "len:(0,1)",128,0,741,-16 .stabn 192,0,0,.LBB140-.LFB22 .stabs "ch:(0,1)",128,0,742,-20 .stabn 192,0,0,.LBB141-.LFB22 .stabs "i:(0,1)",128,0,743,-24 This assembler code is according to the type with one pointer as first element, chars pointer the second element: (gdb) ptype expectedName type = class org.apache.xerces.utils.StringPool$CharArrayRange extends java.lang.Object { private org.apache.xerces.utils.StringPool this$0; public class char[] chars; public int offset; public int length; StringPool__U24_CharArrayRange(org.apache.xerces.utils.StringPool); } But apparently there is a second invisible element in expectedName, and chars is the third element, offset the fourth, etc: (gdb) i lo expected = char[]@8634f80 offset = 140963840 len = 357 (gdb) p/x offset $8 = 0x866f000 (gdb) p expectedName $9 = org.apache.xerces.utils.StringPool$CharArrayRange@8693498 (gdb) p expectedName.chars $10 = char[]@866f000 (gdb) p expectedName.offset $11 = 357 (gdb) p expectedName.length $12 = 13 >How-To-Repeat: It is impossible for me to isolate a test case from xerces. I'd have to build an independent test case. Please mail me, if you need it. >Fix: >Release-Note: >Audit-Trail: >Unformatted: