java/5812: GCJ 3.0.2 segfaults on class file from Sun JDK 1.3 compiler

Tom Tromey tromey@redhat.com
Sat Mar 2 10:46:00 GMT 2002


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

From: Tom Tromey <tromey@redhat.com>
To: adam@medovina.org
Cc: gcc-gnats@gcc.gnu.org, Per Bothner <per@bothner.com>
Subject: Re: java/5812: GCJ 3.0.2 segfaults on class file from Sun JDK 1.3 compiler
Date: 02 Mar 2002 12:10:11 -0700

 >>>>> "Adam" == Adam Dingle <adam@medovina.org> writes:
 
 Adam> When I compile the class definition below with the Sun JDK 1.3
 Adam> compiler and then feed the class file to GCJ 3.0.2, GCJ
 Adam> segfaults.  I've included the .class file as an attachment.
 
 First, I agree that gcj should not crash.  That is a bug.
 
 However, this is unusual bytecode.
 Here it is:
 
   0: jsr 12
   3: goto 15
   6: astore_1
   7: jsr 12
  10: aload_1
  11: athrow
  12: astore_2
  13: iconst_1
  14: ireturn
  15: return
 
 It isn't clear to me whether this should verify.
 The `return' at PC=15 is invalid, since the method signature is ()I.
 Ordinarily this would be a verification error.
 
 However, given that Sun's compiler generated this, perhaps they intend
 that we only verify reachable code.  In this case, the `return' is not
 reachable since there is no `ret' corresponding to the `jsr'.
 
 Per, what do you think about this?
 
 I do think it is bogus that Sun's compiler does this.
 For this source we generate the aesthetically pleasing:
 
   0: iconst_1
   1: ireturn
 
 Tom



More information about the Gcc-prs mailing list