public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: java/5042: java: wrong addressing of inner class attributes
@ 2002-10-08  7:07 aph
  0 siblings, 0 replies; 4+ messages in thread
From: aph @ 2002-10-08  7:07 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, java-prs, nobody, r.hautz

Synopsis: java: wrong addressing of inner class attributes

State-Changed-From-To: open->feedback
State-Changed-By: aph
State-Changed-When: Tue Oct  8 07:07:12 2002
State-Changed-Why:
    No response from submitter.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=5042


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: java/5042: java: wrong addressing of inner class attributes
@ 2003-02-23 21:11 neroden
  0 siblings, 0 replies; 4+ messages in thread
From: neroden @ 2003-02-23 21:11 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, java-prs, nobody, r.hautz

Synopsis: java: wrong addressing of inner class attributes

State-Changed-From-To: feedback->closed
State-Changed-By: neroden
State-Changed-When: Sun Feb 23 21:11:30 2003
State-Changed-Why:
    No response from submitter > 3 mo.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=5042


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: java/5042: java: wrong addressing of inner class attributes
@ 2002-05-29 23:56 Bryce McKinlay
  0 siblings, 0 replies; 4+ messages in thread
From: Bryce McKinlay @ 2002-05-29 23:56 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR java/5042; it has been noted by GNATS.

From: Bryce McKinlay <bryce@waitaki.otago.ac.nz>
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: Re: java/5042: java: wrong addressing of inner class attributes
Date: Thu, 30 May 2002 18:19:09 +1200

 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=5042
 
 I've just been looking at the code produced by the current GCJ for 
 AbstractCharReader.scanExpectedName:
 
     movl    16(%ebp), %eax    #  expectedName,  expectedName
     movzwl    12(%ebp), %edx    #  fastcheck
     movl    8(%ebp), %ebx    #  this,  this
     cmpb    $11, 
 _ZN3org6apache6xerces5utils22XMLCharacterProperties6class$E+74    #  
 <variable>.state
     movl    52(%ebx), %esi    #  <variable>.fMostRecentChar,  ch
     movl    %edx, -16(%ebp)    #  fastcheck
     movl    8(%eax), %edx    #  <variable>.chars
 
 
 Here the expectedName.chars field is accessed at offset 8 which seems 
 correct to me (the first two fields are the class pointer and this$0).
 
 Does this bug still occur with GCc 3.1 or newwer or should I close this PR?
 
 regards
 
 Bryce.
 
 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* java/5042: java: wrong addressing of inner class attributes
@ 2001-12-07  6:36 roland
  0 siblings, 0 replies; 4+ messages in thread
From: roland @ 2001-12-07  6:36 UTC (permalink / raw)
  To: gcc-gnats


>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 <this> 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:


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-02-23 21:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-08  7:07 java/5042: java: wrong addressing of inner class attributes aph
  -- strict thread matches above, loose matches on Subject: below --
2003-02-23 21:11 neroden
2002-05-29 23:56 Bryce McKinlay
2001-12-07  6:36 roland

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).