java/2916: gcj 2.97 produces wrong code for concatenation and final
iglewski@solidum.com
iglewski@solidum.com
Wed May 23 10:56:00 GMT 2001
>Number: 2916
>Category: java
>Synopsis: gcj 2.97 produces wrong code for concatenation and final
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed May 23 10:56:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator: Michal Iglewski <michal@solidum.com>
>Release: unknown-1.0
>Organization:
>Environment:
linux
>Description:
The concatenation operator produces, in some (?) situations,
wrong code if the first arg is a final string.
Removing 'final' in the example below solves
the problem.
Replacing '+' by concat() also solves the problem.
public class ERROR {
static public void error(String msg){
System.err.println("Error: " + msg);
}
public static final String sth = "sth";
}
public class test {
public static void main(String args[]){
System.out.println(ERROR.sth+"aaaa");
ERROR.error(ERROR.sth+"bbbb");
}
}
$ gcj -C ERROR.java
$ gcj -C test.java
$ jar cf t.jar ERROR.class test.class
$ gcj -c -g t.jar
$ gcj -o t t.o --main=test
$ ./t
s
Error: s
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the Gcc-bugs
mailing list