java/5368: gcj-3.0.3 segfaults with 20 line program
Sun Jan 13 07:16:00 GMT 2002

>Number:         5368
>Category:       java
>Synopsis:       gcj-3.0.3 segfaults with 20 line program
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    unassigned
>State:          open
>Class:          ice-on-legal-code
>Submitter-Id:   net
>Arrival-Date:   Sun Jan 13 07:16:00 PST 2002
>Release:        gcj-3.0.3
Here's the whole story:

$ ls -RF .
b/  test/


$ gcj -v -I. -C test/ 
Reading specs from /usr/lib/gcc-lib/alpha-linux/3.0.3/specs
Configured with: ../src/configure -v --enable-languages=c,c++,java,f77,proto,objc --prefix=/usr --infodir=/share/info --mandir=/share/man --enable-shared --with-gnu-as --with-gnu-ld --with-system-zlib --enable-long-long --enable-nls --without-included-gettext --disable-checking --enable-threads=posix --enable-java-gc=boehm --with-cpp-install-dir=bin --enable-objc-gc alpha-linux
Thread model: posix
gcc version 3.0.3
 /usr/lib/gcc-lib/alpha-linux/3.0.3/jc1 test/ -quiet -dumpbase -g1 -version -fsyntax-only -femit-class-files -o /dev/null -I.
GNU Java version 3.0.3 (alpha-linux)
        compiled by GNU C version 3.0.3.
test/ In class `gcj_test':
test/ In method `gcj_test.gcj_segf_dummy(java.lang.String,java.lang.String,java.lang.String)':
test/ Internal error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:> for instructions.
$ uname -a
Linux bandit 2.2.17 #1 Thu Jun 29 13:33:28 EDT 2000 alpha unknown
(this just repeats the contents of the archive file)

$ cat b/ 
package b;

public class a
    public static void qqq(String s1, String s2, String s3)
        System.out.println(s1 + s2 + s3);
$ cat test/ 
import b.a;

public class gcj_test
    public static void gcj_segf_dummy(String s1, String s2, String s3)
        b.a.qqq(s1, s2, s3);

    public static boolean b;
The problem seems to be the ambiguity caused by the package 'b' having the same name as a member variable of class 'gcj_test'. If the member name is changed, the segfault goes away. However, the compiler should not segfault on ANY input. This example is easily fixed, but this is not the case when you are working with a large body of existing code, as I was when I discovered this problem.
Content-Type: application/gzip; name="segf.tar.gz"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="segf.tar.gz"


More information about the Java-prs mailing list