Very simple strange bug

Martin Kahlert martin.kahlert@infineon.com
Wed Feb 21 06:28:00 GMT 2001


Hi!
I simplified my bugreport (gnats: java/2008) even more:

cat buggy.java

public class buggy
{
 public static void main(String[] args)
    {
     String s[] = new String[1];

     s[0]  =  "";
     s[0] +=  "";
    }
}

gcj -c buggy.java
buggy.java: In class `buggy':
buggy.java: In method `buggy.main(java.lang.String[])':
buggy.java:8: Tree check: expected class 'e', have 'd' (function_decl)
buggy.java:8: confused by earlier errors, bailing out

It is neccessary, that s is an array of strings. A simple String works.

If you change 
s[0] +=  "";
into
s[0] =  s[0] + "";
it works, too.

Strange....

gcj -v:
Reading specs from /sw/gcc-3/lib/gcc-lib/i686-pc-linux-gnu/3.0/specs
Reading specs from
/sw/gcc-3/lib/gcc-lib/i686-pc-linux-gnu/3.0/../../../libgcj.spec
rename spec lib to liborig
rename spec startfile to startfileorig
Configured with: ../configure --prefix=/sw/gcc-3
--enable-languages=c++,f77,java --enable-threads=posix
gcc version 3.0 20010221 (prerelease)

Bye,
Martin.

-- 
The early bird gets the worm. If you want something else for       
breakfast, get up later.



More information about the Java mailing list