This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

BugReport for gcj-3.3 java frontend


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)



public abstract class GcjBug
{
    public final static byte FXP_INIT           = 1;

    public final static byte FXP_VERSION        = 2;

    public final static byte FXP_OPEN           = 3;

    public final static byte FXP_CLOSE          = 4;

    public final static byte FXP_READ           = 5;

    public final static byte FXP_WRITE          = 6;

    public final static byte FXP_LSTAT          = 7;

    public final static byte FXP_FSTAT          = 8;

    public final static byte FXP_SETSTAT        = 9;

    public final static byte FXP_FSETSTAT       = 10;

    public final static byte FXP_OPENDIR        = 11;

    public final static byte FXP_READDIR        = 12;

    public final static byte FXP_REMOVE         = 13;

    public final static byte FXP_MKDIR          = 14;

    public final static byte FXP_RMDIR          = 15;

    public final static byte FXP_REALPATH       = 16;

    public final static byte FXP_STAT           = 17;

    public final static byte FXP_RENAME         = 18;

    public final static byte FXP_READLINK       = 19;

    public final static byte FXP_SYMLINK        = 20;

    public final static byte FXP_STATUS         = 101;

    public final static byte FXP_HANDLE         = 102;

    public final static byte FXP_DATA           = 103;

    public final static byte FXP_NAME           = 104;

    public final static byte FXP_ATTRS          = 105;

    // Constant value changed from 200 to something below 128
    public final static byte FXP_EXTENDED       = 106;

    // Need at least one value as a byte that causes sign extension (is a negative value
    // as a byte)
    public final static byte FXP_EXTENDED_REPLY = (byte) 201;

    public static String getPacketTypeName(int type)
    {
        switch (type)
        {
        case GcjBug.FXP_OPENDIR:
            return "OPENDIR";
        case GcjBug.FXP_READDIR:
            return "READDIR";
        case GcjBug.FXP_REMOVE:
            return "REMOVE";
        case GcjBug.FXP_MKDIR:
            return "MKDIR";
        case GcjBug.FXP_RMDIR:
            return "RMDIR";
        case GcjBug.FXP_REALPATH:
            return "REALPATH";
        case GcjBug.FXP_STAT:
            return "STAT";
        case GcjBug.FXP_RENAME:
            return "RENAME";
        case GcjBug.FXP_READLINK:
            return "READLINK";
        case GcjBug.FXP_SYMLINK:
            return "SYMLINK";
        case GcjBug.FXP_STATUS:
            return "STATUS";
        case GcjBug.FXP_HANDLE:
            return "HANDLE";
        case GcjBug.FXP_DATA:
            return "DATA";
        case GcjBug.FXP_NAME:
            return "NAME";
        case GcjBug.FXP_ATTRS:
            return "ATTRS";
        case GcjBug.FXP_EXTENDED:
            return "EXTENDED";
        case GcjBug.FXP_EXTENDED_REPLY:
            return "EXTENDED_REPLY";
        }
        return null;
    }
}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]