public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* java/1233: gcj crashes when trying to compile this code!
@ 2000-12-20 12:22 mdejong
  0 siblings, 0 replies; only message in thread
From: mdejong @ 2000-12-20 12:22 UTC (permalink / raw)
  To: java-gnats

>Number:         1233
>Category:       java
>Synopsis:       gcj crashes when trying to compile this code!
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    apbianco
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Dec 20 12:18:04 PST 2000
>Closed-Date:    Tue Apr 25 16:01:27 PDT 2000
>Last-Modified:  Tue Apr 25 16:16:00 PDT 2000
>Originator:     Mo
>Release:        egcs from CVS Sun Apr  9
>Organization:
>Environment:
Red Hat 5.2 system.
>Description:
Here is some code that does not compile with javac.

% javac Regexp.java
Regexp.java:553: Method nextMatch() not found in class java.lang.Object.
        if (rs.nextMatch()) {
                        ^
Regexp.java:554: Method skipped() not found in class java.lang.Object.
            StringBuffer sb = new StringBuffer(rs.skipped());
                                                         ^
Regexp.java:556: Method rest() not found in class java.lang.Object.
            sb.append(rs.rest());
                             ^
Regexp.java:613: Method matched() not found in class java.lang.Object.
                        sb.append(rs.matched());
                                            ^
Regexp.java:620: Method submatch(int) not found in class java.lang.Object.
                            String match = rs.submatch(ch - '0');
                                                      ^
Regexp.java:645: Method nextMatch() not found in class java.lang.Object.
        if (rs.nextMatch() == false) {
                        ^
Regexp.java:651: Method skipped() not found in class java.lang.Object.
            sb.append(rs.skipped());
                                ^
Regexp.java:655: Method nextMatch() not found in class java.lang.Object.
        } while (rs.nextMatch());
                             ^
Regexp.java:656: Method rest() not found in class java.lang.Object.
        sb.append(rs.rest());
                         ^
9 errors


If I try to compile it with gcj, I get a SIGSEGV.


lookup_do (searched_class=0x8272ba8, searched_interface=0x82d2994, 
    method_name=0x82b4ddc, signature=0x8295d98, 
    signature_builder=0x8079fac <build_java_argument_signature>)
    at ../../../egcs/gcc/java/typeck.c:784
784              tree iclass = BINFO_TYPE (child);

(gdb) list
779
780           for (i = interface_len; i > 0; i--)
781            {
782              tree child = 
783                TREE_VEC_ELT (TYPE_BINFO_BASETYPES (searched_interface), i);
784              tree iclass = BINFO_TYPE (child);
785
786              /* If the superinterface hasn't been loaded yet, do so now.  */
787              if (CLASS_FROM_SOURCE_P (iclass))
788                safe_layout_class (iclass);

(gdb) print child
$1 = (union tree_node *) 0x0

So child is getting set to NULL and BINFO_TYPE() is crashing out because of it.
>How-To-Repeat:
Just compile with gcj.
>Fix:
Do we need to do an extra check for NULL before calling
BINFO_TYPE?
>Release-Note:

>Audit-Trail:

Formerly PR gcj/198


From: Mo DeJong <mdejong@cygnus.com>
To: java-gnats@sourceware.cygnus.com, apbianco@cygnus.com
Cc:  
Subject: Re: gcj/198: gcj crashes when trying to compile this code!
Date: Sun, 9 Apr 2000 05:50:37 -0700 (PDT)

 I was able to trim the gcj crasher described in pr 198 to the following.
 Could the download like I put up originally be replaced by this?
 I did not see any way to change anything in gnats once it was submitted.
 
 
 // File Regexp.java
 
 import java.util.*;
 import java.io.*;
 
 public class Regexp
 {
     public interface Filter
     {
 	public boolean filter(Object rs, StringBuffer sb);
     }
 
     private static class SubspecFilter implements Filter
     {
 	public boolean
 	filter(Object rs, StringBuffer sb)
 	{
 	    return true;
 	}
     }
 
     static class Compiler {}
 
     static class Match {
 	// Whats odd is that the core dump changes location
 	// if you coment out the following method!
 	void regtry(int off) {}
     }
 }
 
 
 
 
 The GDB info is the same.
 
 (gdb) bt
 #0  lookup_do (searched_class=0x8272ba8, searched_interface=0x82919b4, 
     method_name=0x8291be4, signature=0x8291d04, 
     signature_builder=0x8079fac <build_java_argument_signature>)
     at ../../../egcs/gcc/java/typeck.c:784
 #1  0x807a448 in lookup_argument_method2 (searched_class=0x82919b4, 
     method_name=0x8291be4, method_signature=0x8291d04)
     at ../../../egcs/gcc/java/typeck.c:733
 #2  0x805b578 in java_check_regular_methods (class_decl=0x8291a70) at
 ./parse.y:5927
 #3  0x805d870 in java_layout_classes () at ./parse.y:7159
 #4  0x805f65d in java_expand_classes () at ./parse.y:8245
 #5  0x807fdc2 in yyparse () at ../../../egcs/gcc/java/jcf-parse.c:897
 #6  0x8089312 in compile_file (name=0xbffff8f4 "Regexp.java")
     at ../../egcs/gcc/toplev.c:2391
 #7  0x808c254 in main (argc=2, argv=0xbffff794) at
 ../../egcs/gcc/toplev.c:4667
 
 (gdb) list
 779
 780           for (i = interface_len; i > 0; i--)
 781            {
 782              tree child = 
 783                TREE_VEC_ELT (TYPE_BINFO_BASETYPES
 (searched_interface), i);
 784              tree iclass = BINFO_TYPE (child);
 785
 786              /* If the superinterface hasn't been loaded yet, do so
 now.  */
 787              if (CLASS_FROM_SOURCE_P (iclass))
 788                safe_layout_class (iclass);
 
 (gdb) print child
 $1 = (union tree_node *) 0x0
 
 
 
 Mo Dejong
 Red Hat Inc.
 
State-Changed-From-To: open->closed
State-Changed-By: apbianco
State-Changed-When: Tue Apr 25 16:01:27 2000
State-Changed-Why:
    The following (already checked in) patch fixes the problem
    (gcj compiles this code correctly, jikes and javac
     from the JDK 1.1.8 too:)
    
    
      http://gcc.gnu.org/ml/gcc-patches/2000-04/msg01001.html

From: apbianco@cygnus.com
To: apbianco@cygnus.com, java-gnats@sourceware.cygnus.com, mdejong@cygnus.com
Cc:  
Subject: Re: gcj/198
Date: 25 Apr 2000 23:01:27 -0000

 Synopsis: gcj crashes when trying to compile this code!
 
 State-Changed-From-To: open->closed
 State-Changed-By: apbianco
 State-Changed-When: Tue Apr 25 16:01:27 2000
 State-Changed-Why:
     The following (already checked in) patch fixes the problem
     (gcj compiles this code correctly, jikes and javac
      from the JDK 1.1.8 too:)
     
     
       http://gcc.gnu.org/ml/gcc-patches/2000-04/msg01001.html
 
 http://sourceware.cygnus.com/cgi-bin/gnatsweb.pl?cmd=view&pr=198&database=java
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="snip"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="snip"

LyBGaWxlIFJlZ2V4cC5qYXZhCiAKIGltcG9ydCBqYXZhLnV0aWwuKjsKIGltcG9ydCBqYXZhLmlv
Lio7CiAKIHB1YmxpYyBjbGFzcyBSZWdleHAKIHsKICAgICBwdWJsaWMgaW50ZXJmYWNlIEZpbHRl
cgogICAgIHsKICAgICAgICBwdWJsaWMgYm9vbGVhbiBmaWx0ZXIoT2JqZWN0IHJzLCBTdHJpbmdC
dWZmZXIgc2IpOwogICAgIH0KIAogICAgIHByaXZhdGUgc3RhdGljIGNsYXNzIFN1YnNwZWNGaWx0
ZXIgaW1wbGVtZW50cyBGaWx0ZXIKICAgICB7CiAgICAgICAgcHVibGljIGJvb2xlYW4KICAgICAg
ICBmaWx0ZXIoT2JqZWN0IHJzLCBTdHJpbmdCdWZmZXIgc2IpCiAgICAgICAgewogICAgICAgICAg
ICByZXR1cm4gdHJ1ZTsKICAgICAgICB9CiAgICAgfQogCiAgICAgc3RhdGljIGNsYXNzIENvbXBp
bGVyIHt9CiAKICAgICBzdGF0aWMgY2xhc3MgTWF0Y2ggewogICAgICAgIC8vIFdoYXRzIG9kZCBp
cyB0aGF0IHRoZSBjb3JlIGR1bXAgY2hhbmdlcyBsb2NhdGlvbgogICAgICAgIC8vIGlmIHlvdSBj
b21lbnQgb3V0IHRoZSBmb2xsb3dpbmcgbWV0aG9kIQogICAgICAgIHZvaWQgcmVndHJ5KGludCBv
ZmYpIHt9CiAgICAgfQogfQo=



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2000-12-20 12:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-12-20 12:22 java/1233: gcj crashes when trying to compile this code! mdejong

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).