BugReport for gcj-3.3 java frontend
Erwin Bolwidt
erwin@klomp.org
Thu Mar 11 14:13:00 GMT 2004
Hello,
I found a bug in gcj-3.3. It looks like this from the command line:
$ gcj-3.3 -c GcjBug.java
GcjBug.java: In class `GcjBug':
GcjBug.java: In method `GcjBug.getPacketTypeName(int)':
GcjBug.java:62: internal compiler error: in tree_low_cst, at tree.c:3255
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
I've included a test case as an attachment called GcjBug.java. It is
derived from a file in my application that caused this problem, but
strips code that isn't necessary to show the bug.
I've done some analyses in the Java source to find out what might
trigger the bug in particular, and also discovered a workaround.
The bug occurs when there is a switch statement, in which the expression
is of type 'int', and all case labels are constants of type 'byte'.
I've found two requirements to trigger the bug:
- there must be at least 17 case labels (I had plenty more in the
original source, but less than 17 labels doesn't trigger the bug)
- at least one of the case labels must have a negative value as a byte,
such as '(byte) 202'.
The workaround is: cast the expression of the switch statement to type
byte, i.e. change 'switch (type)' to 'switch ((byte)type)' in the
GcjBug.java source code.
Hopefully this report is useful enough to fix the bug :-)
Greetings,
Erwin Bolwidt
P.s.
GCJ version information:
$ gcj-3.3 -v
Reading specs from /usr/lib/gcc-lib/i486-linux/3.3.3/specs
Reading specs from /usr/lib/gcc-lib/i486-linux/3.3.3/../../../libgcj.spec
rename spec lib to liborig
Configured with: ../src/configure -v
--enable-languages=c,c++,java,f77,pascal,objc,ada,treelang --prefix=/usr
--mandir=/usr/share/man --infodir=/usr/share/info
--with-gxx-include-dir=/usr/include/c++/3.3 --enable-shared
--with-system-zlib --enable-nls --without-included-gettext
--enable-__cxa_atexit --enable-clocale=gnu --enable-debug
--enable-java-gc=boehm --enable-java-awt=xlib --enable-objc-gc i486-linux
Thread model: posix
gcc version 3.3.3 (Debian 20040306)
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: GcjBug.java
URL: <http://gcc.gnu.org/pipermail/java/attachments/20040311/de2c8b60/attachment.ksh>
More information about the Java
mailing list