From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 711 invoked by alias); 27 May 2002 05:56:01 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 697 invoked by uid 71); 27 May 2002 05:56:01 -0000 Date: Sun, 26 May 2002 23:56:00 -0000 Message-ID: <20020527055601.696.qmail@sources.redhat.com> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, From: Bryce McKinlay Subject: Re: java/6820: miscompilation of (a,++a) as arguments to final method Reply-To: Bryce McKinlay X-SW-Source: 2002-05/txt/msg00847.txt.bz2 List-Id: The following reply was made to PR java/6820; it has been noted by GNATS. From: Bryce McKinlay To: gcc-gnats@gcc.gnu.org Cc: Subject: Re: java/6820: miscompilation of (a,++a) as arguments to final method Date: Mon, 27 May 2002 17:53:33 +1200 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=6820 I checked in a similar test case to the testsuite: public class PR6820 { static void m(int a, int b) { System.out.println("a="+a+" b="+b); } static int a = 10; public static void main(String[] args) { int b = 10; m(a,++a); m(b,++b); } } This appears to be a problem with the (deprecated) RTL inliner which is still used by gcj. When a call is inlined, the Java evalutation order for the arguments (set by force_evaluation_order() in java/expr.c) seems to get lost. Workaround is to compile with -O2 -fno-inline Solution may be to switch gcj to use the AST inliner.