This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
java/2299: Problem with String Arrays and +=
- To: gcc-gnats at gcc dot gnu dot org
- Subject: java/2299: Problem with String Arrays and +=
- From: Martin Kahlert <martin dot kahlert at infineon dot com>
- Date: Fri, 16 Mar 2001 11:03:52 +0100
- Reply-To: martin dot kahlert at infineon dot com
>Number: 2299
>Category: java
>Synopsis: Use of += for String arrays produces Segfault during compilation
>Confidential: no
>Severity: serious
>Priority: high
>Responsible: unassigned
>State: open
>Class: ice-on-legal-code
>Submitter-Id: net
>Arrival-Date: Fri Mar 16 02:16:01 PST 2001
>Closed-Date:
>Last-Modified:
>Originator: Martin Kahlert
>Release: 3.0 20010312 (prerelease)
>Organization:
Infineon AG
>Environment:
System: Linux keksy 2.2.18 #5 SMP Wed Jan 24 09:24:42 CET 2001 i686 unknown
Architecture: i686
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../configure --prefix=/sw/gcc-3 --enable-languages=c++,f77,java --enable-threads=posix
>Description:
The += operator for string arrays does not work.
It works for strings.
s[0] = s[0] + string works, too, though this should be equivalent to s[0] += string
This error report is meant to replace the report
java/2008: ICE in gcj (no optimization),
because it is a much simpler testcase.
Sorry, i don't know how to do that myself.
>How-To-Repeat:
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: Internal error: Segmentation fault
Please submit a full bug report, with preprocessed source if appropriate.
See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.
>Fix:
Workaround: Use s[0] = s[0] + "" instead of s[0] += ""
>Release-Note:
>Audit-Trail:
>Unformatted: