This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
Re: java/6820: miscompilation of (a,++a) as arguments to final method
- From: Bryce McKinlay <bryce at waitaki dot otago dot ac dot nz>
- To: nobody at gcc dot gnu dot org
- Cc: gcc-prs at gcc dot gnu dot org,
- Date: 27 May 2002 05:56:01 -0000
- Subject: Re: java/6820: miscompilation of (a,++a) as arguments to final method
- Reply-to: Bryce McKinlay <bryce at waitaki dot otago dot ac dot nz>
The following reply was made to PR java/6820; it has been noted by GNATS.
From: Bryce McKinlay <bryce@waitaki.otago.ac.nz>
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.