This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


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

java/2916: gcj 2.97 produces wrong code for concatenation and final



>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:


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