From mboxrd@z Thu Jan 1 00:00:00 1970 From: iglewski@solidum.com To: gcc-gnats@gcc.gnu.org Subject: java/2916: gcj 2.97 produces wrong code for concatenation and final Date: Wed, 23 May 2001 10:56:00 -0000 Message-id: <20010523175533.24905.qmail@sourceware.cygnus.com> X-SW-Source: 2001-05/msg00689.html List-Id: >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 >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: